private static IConfigurationBuilder AddVault(this IConfigurationBuilder builder, VaultOptions options, string key) { var client = new VaultStore(options); var secret = string.IsNullOrWhiteSpace(key) ? client.GetDefaultAsync().GetAwaiter().GetResult() : client.GetAsync(key).GetAwaiter().GetResult(); var parser = new JsonParser(); var data = parser.Parse(JObject.FromObject(secret)); var source = new MemoryConfigurationSource { InitialData = data }; builder.Add(source); return(builder); }
public VaultStore(VaultOptions options) { _options = options; LoadEnvironmentVariables(); }