private async Task RefreshSetting(string key) { //eliminate the before and after characters the ${ and the } string newKey = key.Substring(2, key.Length - 3); //split the string by the delimeter string[] kvParameters = Regex.Split(newKey, __delimiter, RegexOptions.None); //get the vault name from the element string kvName = kvParameters[1]; //get the configuration section for this vault KeyVaultConfigurationElement section = KeyVaultConfigurationSection.Instance.Vaults[kvName]; //create and instance of the settings class that translates between the config and the kv connector dll KeyVaultSettings settings = new KeyVaultSettings(section); //Use the settings to update this item in the cache _kvItems.AddOrUpdate(key, await settings.GetSecret(kvParameters[2]), (thiskey, thisvalue) => thisvalue); //And update the expiration time for this item _expirations.AddOrUpdate(key, DateTime.Now.AddSeconds(RefreshFrequency), (thiskey, thisvalue) => thisvalue); }
internal KeyVaultSettings(KeyVaultConfigurationElement section) { _section = section; }