public static async Task Main(string[] args) { var stash = new Credstash(new CredstashOptions(), new AmazonKeyManagementServiceClient(RegionEndpoint.EUWest1), new AmazonDynamoDBClient(RegionEndpoint.EUWest1)); var noneExistingKey1 = await stash.GetSecretAsync(Guid.NewGuid().ToString()); var noneExistingKey2 = await stash.GetSecretAsync(Guid.NewGuid().ToString(), "1"); //var creds = new GetAwsCredentials(); //var stash = new Credstash(new CredstashOptions(), new AmazonKeyManagementServiceClient(creds, RegionEndpoint.EUWest1), // new AmazonDynamoDBClient(creds, RegionEndpoint.EUWest1)); //var val = stash.GetSecret("redis:host", null, new Dictionary<string, string>() //{ // { "environment", "beta"} //}).Result; //Console.WriteLine(val); //foreach (var entry in stash.List().Result) //{ // Console.WriteLine($"{entry.Name} v{entry.Version}"); //} var creds = GetAwsCredentials(); var configBuilder = new ConfigurationBuilder(); configBuilder.AddCredstash(creds, new CredstashConfigurationOptions { EncryptionContext = new Dictionary <string, string> { { "environment", "beta" } } }); var config = configBuilder.Build(); var beta = config.GetSection("beta"); Print(beta, string.Empty); }
private async Task SetConfigValueAsync(Dictionary <string, string> data, string entry) { try { var secret = await _credstash.GetSecretAsync(entry, null, _encryptionContext, false).ConfigureAwait(false); if (secret.HasValue) { data.Add(entry, secret.Value); } } catch (Exception) { //eat everything } }
private async Task SetConfigValueAsync(ConcurrentDictionary <string, string> data, string entry) { try { var secret = await _credstash.GetSecretAsync(entry, null, _encryptionContext, false); if (secret.HasValue) { data.TryAdd(entry, secret.Value); } } catch { if (!_suppressErrors) { throw; } } }