Upating
This commit is contained in:
+4
-1
@@ -50,8 +50,11 @@
|
||||
"http://lcu-internal.com",
|
||||
"https://lcu-internal.com",
|
||||
"https://qa-repomanage.lcu-internal.com",
|
||||
"https://qa-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://uat-repomanage.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com"
|
||||
"https://uat-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com",
|
||||
"https://prd-repo-manager.apps.azure.lcu-internal.com"
|
||||
]
|
||||
},
|
||||
"NadaService": {
|
||||
|
||||
+4
-1
@@ -50,8 +50,11 @@
|
||||
"http://lcu-internal.com",
|
||||
"https://lcu-internal.com",
|
||||
"https://qa-repomanage.lcu-internal.com",
|
||||
"https://qa-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://uat-repomanage.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com"
|
||||
"https://uat-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com",
|
||||
"https://prd-repo-manager.apps.azure.lcu-internal.com"
|
||||
]
|
||||
},
|
||||
"NadaService": {
|
||||
|
||||
+4
-1
@@ -50,8 +50,11 @@
|
||||
"http://lcu-internal.com",
|
||||
"https://lcu-internal.com",
|
||||
"https://qa-repomanage.lcu-internal.com",
|
||||
"https://qa-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://uat-repomanage.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com"
|
||||
"https://uat-repo-manager.apps.azure.lcu-internal.com",
|
||||
"https://repomanage.lcu-internal.com",
|
||||
"https://prd-repo-manager.apps.azure.lcu-internal.com"
|
||||
]
|
||||
},
|
||||
"NadaService": {
|
||||
|
||||
+2
-35
@@ -1,5 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
@@ -23,9 +21,10 @@ namespace LCU.Webapps.Marketing.SPIT
|
||||
builder.AddJsonFile("/app/config/workload-appsettings/appsettings.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-seq-api-key.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-primary-subscription-key.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-speech-api-key.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-speech-endpoint.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-azuread-client-id.json", optional: true, reloadOnChange: true);
|
||||
builder.AddJsonFile("/vault/secrets/spit-azuread-client-secret.json", optional: true, reloadOnChange: true);
|
||||
builder.AddInMemoryCollection(LoadPlainTextSpeechSecrets());
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
@@ -33,37 +32,5 @@ namespace LCU.Webapps.Marketing.SPIT
|
||||
.UseSetting(WebHostDefaults.DetailedErrorsKey, "true")
|
||||
.UseSerilog();
|
||||
});
|
||||
|
||||
private static IDictionary<string, string> LoadPlainTextSpeechSecrets()
|
||||
{
|
||||
var configValues = new Dictionary<string, string>();
|
||||
var secretMappings = new[]
|
||||
{
|
||||
(Path: "/vault/secrets/speech-api-key", Key: "Primary:SpeechApiKey"),
|
||||
(Path: "/vault/secrets/speech-endpoint", Key: "Primary:SpeechEndpoint"),
|
||||
};
|
||||
|
||||
foreach (var secretMapping in secretMappings)
|
||||
{
|
||||
TryAddSecretValue(configValues, secretMapping.Path, secretMapping.Key);
|
||||
}
|
||||
|
||||
return configValues;
|
||||
}
|
||||
|
||||
private static void TryAddSecretValue(IDictionary<string, string> configValues, string path, string key)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var value = File.ReadAllText(path)?.Trim();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
configValues[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -28,17 +28,17 @@
|
||||
path: /spec/template/spec/containers/0/volumeMounts/-
|
||||
value:
|
||||
name: spit-secrets
|
||||
mountPath: /vault/secrets/speech-api-key
|
||||
mountPath: /vault/secrets/spit-speech-api-key.json
|
||||
readOnly: true
|
||||
subPath: speech-api-key
|
||||
subPath: spit-speech-api-key
|
||||
|
||||
- op: add
|
||||
path: /spec/template/spec/containers/0/volumeMounts/-
|
||||
value:
|
||||
name: spit-secrets
|
||||
mountPath: /vault/secrets/speech-endpoint
|
||||
mountPath: /vault/secrets/spit-speech-endpoint.json
|
||||
readOnly: true
|
||||
subPath: speech-endpoint
|
||||
subPath: spit-speech-endpoint
|
||||
|
||||
- op: add
|
||||
path: /spec/template/spec/containers/0/volumeMounts/-
|
||||
|
||||
+2
-2
@@ -11,11 +11,11 @@
|
||||
objectType: secret
|
||||
objectVersion: ""
|
||||
- |
|
||||
objectName: speech-api-key
|
||||
objectName: spit-speech-api-key
|
||||
objectType: secret
|
||||
objectVersion: ""
|
||||
- |
|
||||
objectName: speech-endpoint
|
||||
objectName: spit-speech-endpoint
|
||||
objectType: secret
|
||||
objectVersion: ""
|
||||
- |
|
||||
|
||||
Reference in New Issue
Block a user