Пример #1
0
        public async Task <string> GetConfigValueAsync(Guid appKey, Guid servKey, Guid envKey, string configName)
        {
            string       configNameEncrypted = ConfigNameResolver.CreateConfigName(appKey, servKey, envKey, configName);
            SecretBundle secretItem          = await _client.GetSecretAsync(_keyVaultUrl, configNameEncrypted);

            return(secretItem.Value);
        }
Пример #2
0
        public async Task <IEnumerable <string> > GetConfigNamesAsync(Guid appKey, Guid servKey, Guid envKey, bool decrypt = true)
        {
            IEnumerable <SecretItem> secretItems = await GetSecretItemsAsync(appKey, servKey, envKey);

            return(decrypt
                ? secretItems.Select(item => ConfigNameResolver.DecryptConfigName(appKey, servKey, envKey, item.Identifier.Name))
                : secretItems.Select(item => item.Identifier.Name));
        }
Пример #3
0
        private async Task <IEnumerable <SecretItem> > GetSecretItemsAsync(Guid appKey, Guid servKey, Guid envKey)
        {
            IEnumerable <SecretItem> secretItems = await GetSecretItemsAsync();

            return(from item in secretItems
                   let configName = ConfigNameResolver.DecryptConfigName(appKey, servKey, envKey, item.Identifier.Name)
                                    where configName != null
                                    select item);
        }
Пример #4
0
        public async Task RemoveConfigAsync(Guid appKey, Guid servKey, Guid envKey, string configName)
        {
            string configNameEncrypted = ConfigNameResolver.CreateConfigName(appKey, servKey, envKey, configName);

            await RemoveConfigAsync(configNameEncrypted);
        }
Пример #5
0
 public async Task AddConfigAsync(Guid appKey, Guid servKey, Guid envKey, string configName, string configValue)
 {
     string configNameEncrypted = ConfigNameResolver.CreateConfigName(appKey, servKey, envKey, configName);
     await _client.SetSecretAsync(_keyVaultUrl, configNameEncrypted, configValue);
 }
Пример #6
0
        public async Task <IEnumerable <(string Name, string Value)> > GetConfigsAsync(Guid appKey, Guid servKey, Guid envKey)
        {
            IEnumerable <SecretItem> secretItems = await GetSecretItemsAsync(appKey, servKey, envKey);

            List <Task <(string Name, string Value)> > valueTasks = secretItems.Select(async item => (
                                                                                           ConfigNameResolver.DecryptConfigName(appKey, servKey, envKey, item.Identifier.Name),
                                                                                           (await _client.GetSecretAsync(_keyVaultUrl, item.Identifier.Name)).Value
                                                                                           )).ToList();
            await Task.WhenAll(valueTasks);

            return(valueTasks.Select(task => (task.Result.Name, task.Result.Value)));
        }