Skip to content

Commit

Permalink
Fix environment variable based authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
andychase committed Oct 23, 2024
1 parent 32ac32c commit 90e9ce6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/lib/azure.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// lib/azure.js

import { DefaultAzureCredential } from "@azure/identity";
import { env } from "process";
//import { getCache, setCache } from "./cache";



export async function getAuthToken() {
if (env.AZURE_USE_MANAGED_IDENTITY=="false") {
return "";
}
let cachedToken = process.env.AUTH_TOKEN ? JSON.parse(process.env.AUTH_TOKEN) : '';
if (!cachedToken || cachedToken.expiresOnTimestamp < Date.now()) {
let cachedCredential = new DefaultAzureCredential();
Expand Down

0 comments on commit 90e9ce6

Please sign in to comment.