forked from Patrick-Davis-MSFT/chatbot-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Disable managed identity for now"
This reverts commit 9b98534.
- Loading branch information
Showing
5 changed files
with
13 additions
and
25 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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// import * as Sentry from '@sentry/nextjs'; | ||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
// export async function register() { | ||
// if (process.env.NEXT_RUNTIME === 'nodejs') { | ||
// await import('./sentry.server.config'); | ||
// } | ||
export async function register() { | ||
if (process.env.NEXT_RUNTIME === 'nodejs') { | ||
await import('./sentry.server.config'); | ||
} | ||
|
||
// if (process.env.NEXT_RUNTIME === 'edge') { | ||
// await import('./sentry.edge.config'); | ||
// } | ||
// } | ||
if (process.env.NEXT_RUNTIME === 'edge') { | ||
await import('./sentry.edge.config'); | ||
} | ||
} | ||
|
||
// export const onRequestError = Sentry.captureRequestError; | ||
export {} |
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
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 |
---|---|---|
@@ -1,27 +1,19 @@ | ||
// lib/azure.js | ||
|
||
//import { DefaultAzureCredential } from "@azure/identity"; | ||
//import { log } from "console"; | ||
import { DefaultAzureCredential } from "@azure/identity"; | ||
//import { getCache, setCache } from "./cache"; | ||
|
||
|
||
|
||
export async function getAuthToken() { | ||
if (process.env.AZURE_USE_MANAGED_IDENTITY != "true") { | ||
return ""; | ||
} | ||
let cachedToken = process.env.AUTH_TOKEN ? JSON.parse(process.env.AUTH_TOKEN) : ''; | ||
if (!cachedToken || cachedToken.expiresOnTimestamp < Date.now()) { | ||
let cachedCredential = new DefaultAzureCredential(); | ||
cachedToken = await cachedCredential.getToken("https://cognitiveservices.azure.com/.default"); | ||
//setCache("cachedToken", JSON.stringify(cachedToken)); | ||
//console.log("set the cachedToken in cache"); | ||
//let a = JSON.parse(getCache("cachedToken")); | ||
//console.log("cachedToken from memory", a); | ||
process.env.AUTH_TOKEN = JSON.stringify(cachedToken); | ||
return cachedToken; | ||
} | ||
console.log("cachedToken from memory", cachedToken); | ||
// console.log("cachedToken from memory", cachedToken); | ||
return process.env.AUTH_TOKEN ? JSON.parse(process.env.AUTH_TOKEN) : '';; | ||
} | ||
|
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