diff --git a/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs b/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs index ecddcfb..653d52c 100644 --- a/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs +++ b/Core.Thalos.BuildingBlocks/Helpers/AuthHelper.cs @@ -17,22 +17,27 @@ namespace Core.Thalos.Adapters.Helpers public static AuthSettings GetAuthSettings(WebApplicationBuilder builder, string appConfigLabel) { - builder.Configuration.AddAzureAppConfiguration(options => + var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? string.Empty; + + if (environment != "Local") { - var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value; - - if (string.IsNullOrEmpty(endpoint)) - throw new ArgumentException("The app configuration is missing"); - - options.Connect(new Uri(endpoint), new DefaultAzureCredential()) - .Select(KeyFilter.Any, "thalos_common") - .Select(KeyFilter.Any, appConfigLabel); - - options.ConfigureKeyVault(keyVaultOptions => + builder.Configuration.AddAzureAppConfiguration(options => { - keyVaultOptions.SetCredential(new DefaultAzureCredential()); + var endpoint = builder.Configuration.GetSection("Endpoints:AppConfigurationURI").Value; + + if (string.IsNullOrEmpty(endpoint)) + throw new ArgumentException("The app configuration is missing"); + + options.Connect(new Uri(endpoint), new DefaultAzureCredential()) + .Select(KeyFilter.Any, "thalos_common") + .Select(KeyFilter.Any, appConfigLabel); + + options.ConfigureKeyVault(keyVaultOptions => + { + keyVaultOptions.SetCredential(new DefaultAzureCredential()); + }); }); - }); + } return new AuthSettings {