File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 2323
2424 var builder = WebApplication . CreateBuilder ( args ) ;
2525
26- if ( builder . Environment . IsProduction ( ) )
26+ var keyVaultName = Environment . GetEnvironmentVariable ( "KEY_VAULT_NAME" ) ;
27+ if ( builder . Environment . IsProduction ( ) && ! string . IsNullOrEmpty ( keyVaultName ) )
2728 {
28- var keyVaultName = Environment . GetEnvironmentVariable ( "KEY_VAULT_NAME" ) ;
2929 var keyVaultUri = new Uri ( $ "https://{ keyVaultName } .vault.azure.net/") ;
3030 builder . Configuration . AddAzureKeyVault ( keyVaultUri , new DefaultAzureCredential ( ) ) ;
3131
3232 Log . Logger = new LoggerConfiguration ( )
33- . ReadFrom . Configuration ( config )
33+ . ReadFrom . Configuration ( builder . Configuration )
3434 . WriteTo . Console ( outputTemplate : logFormat , formatProvider : CultureInfo . InvariantCulture )
35- . WriteTo . ApplicationInsights ( config [ "ApplicationInsightsConnectionString "] , TelemetryConverter . Traces )
35+ . WriteTo . ApplicationInsights ( builder . Configuration [ "ApplicationInsights:ConnectionString "] , TelemetryConverter . Traces )
3636 . CreateLogger ( ) ;
3737 }
3838
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ resource "azurerm_application_insights" "ai" {
3030}
3131
3232resource "azurerm_key_vault_secret" "ai_connection_string" {
33- name = " ApplicationInsightsConnectionString "
33+ name = " ApplicationInsights--ConnectionString "
3434 value = azurerm_application_insights. ai . connection_string
3535 key_vault_id = azurerm_key_vault. kv . id
3636}
You can’t perform that action at this time.
0 commit comments