forked from openstad/openstad-image-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use WorkloadIdentityCredential for MySQL Sequelize connection (#2)
- Loading branch information
Showing
4 changed files
with
546 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const { WorkloadIdentityCredential } = require("@azure/identity"); | ||
|
||
const scope = 'https://ossrdbms-aad.database.windows.net/.default' | ||
|
||
// This relies on environment variables that get injected. | ||
// AZURE_AUTHORITY_HOST: (Injected by the webhook) | ||
// AZURE_CLIENT_ID: (Injected by the webhook) | ||
// AZURE_TENANT_ID: (Injected by the webhook) | ||
// AZURE_FEDERATED_TOKEN_FILE: (Injected by the webhook) | ||
const credential = new WorkloadIdentityCredential() | ||
const getAzureAuthToken = async () => (await credential.getToken(scope)).token | ||
|
||
module.exports = getAzureAuthToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.