diff --git a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Program.cs b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Program.cs index f5cf7ff..68fea05 100644 --- a/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Program.cs +++ b/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/LCU.Webapps.Marketing.SPIT/Program.cs @@ -37,14 +37,21 @@ namespace LCU.Webapps.Marketing.SPIT private static IDictionary LoadPlainTextSpeechSecrets() { var configValues = new Dictionary(); + var secretMappings = new[] + { + (Path: "/vault/secrets/speech-api-key", Key: "Primary:SpeechApiKey"), + (Path: "/vault/secrets/speech-endpoint", Key: "Primary:SpeechEndpoint"), + }; - AddSecretValue(configValues, "/vault/secrets/speech-api-key.json", "Primary:SpeechApiKey"); - AddSecretValue(configValues, "/vault/secrets/speech-endpoint.json", "Primary:SpeechEndpoint"); + foreach (var secretMapping in secretMappings) + { + TryAddSecretValue(configValues, secretMapping.Path, secretMapping.Key); + } return configValues; } - private static void AddSecretValue(IDictionary configValues, string path, string key) + private static void TryAddSecretValue(IDictionary configValues, string path, string key) { if (!File.Exists(path)) { diff --git a/LCU.Webapps.Marketing.SPIT/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml b/LCU.Webapps.Marketing.SPIT/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml index 2cf4d4b..ebf158a 100644 --- a/LCU.Webapps.Marketing.SPIT/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml +++ b/LCU.Webapps.Marketing.SPIT/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml @@ -28,7 +28,7 @@ path: /spec/template/spec/containers/0/volumeMounts/- value: name: spit-secrets - mountPath: /vault/secrets/speech-api-key.json + mountPath: /vault/secrets/speech-api-key readOnly: true subPath: speech-api-key @@ -36,7 +36,7 @@ path: /spec/template/spec/containers/0/volumeMounts/- value: name: spit-secrets - mountPath: /vault/secrets/speech-endpoint.json + mountPath: /vault/secrets/speech-endpoint readOnly: true subPath: speech-endpoint