Ejemplo n.º 1
0
        private static void LoadKeyVaultSecrets <T>(
            T section,
            PropertySecretMapping[] additionalPropertyMappings)
            where T : class, new()
        {
            var propertyMappings = GetKeyVaultPropertyMappings <T>().ToArray();

            if (!propertyMappings.Any() && !additionalPropertyMappings.Any())
            {
                return;
            }

            var allProperSecretMappings = propertyMappings.Union(additionalPropertyMappings);

            var configBase = new ConfigurationBuilder();

            configBase
            .UseDefaultConfigs()
            .AddKeyVaultSecrets(allProperSecretMappings.Select(n => n.SecretName).ToArray())
            .SetSecretValues(section, allProperSecretMappings);
        }