File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1+ using Microsoft . Extensions . Configuration ;
2+
3+ namespace Helpers
4+ {
5+ public static class AppGlobals
6+ {
7+ public static IConfiguration Configuration { get ; private set ; }
8+
9+ public static void Init ( IConfiguration configuration )
10+ {
11+ Configuration = configuration ;
12+ }
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ public class azure_credential_utils
99{
1010 public static TokenCredential GetAzureCredential ( string clientId = null )
1111 {
12- var env = Environment . GetEnvironmentVariable ( "ASPNETCORE_ENVIRONMENT" ) ?? "Production" ;
12+ //var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
13+ var appEnv = AppGlobals . Configuration [ "KernelMemory:Services:APP_ENV" ] ?? "prod" ;
1314
14- if ( string . Equals ( env , "Development " , StringComparison . OrdinalIgnoreCase ) )
15+ if ( string . Equals ( appEnv , "dev " , StringComparison . OrdinalIgnoreCase ) )
1516 {
1617 return new DefaultAzureCredential ( ) ; // For local development
1718 }
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ public static void Main(string[] args)
9595 KernelMemoryConfig config = appBuilder . Configuration . GetSection ( "KernelMemory" ) . Get < KernelMemoryConfig > ( )
9696 ?? throw new ConfigurationException ( "Unable to load configuration" ) ;
9797
98+ AppGlobals . Init ( appBuilder . Configuration ) ;
9899 // Some OpenAPI Explorer/Swagger dependencies
99100 appBuilder . ConfigureSwagger ( config ) ;
100101
You can’t perform that action at this time.
0 commit comments