README.md in config-2.2.3 vs README.md in config-3.0.0
- old
+ new
@@ -1,11 +1,11 @@
# Config
-[![Gem Version](https://badge.fury.io/rb/config.svg)](http://badge.fury.io/rb/config)
+[![Version](https://img.shields.io/gem/v/config)](https://rubygems.org/gems/config)
+[![Downloads Total](https://img.shields.io/gem/dt/config)](https://rubygems.org/gems/config)
+[![Build](https://img.shields.io/github/workflow/status/rubyconfig/config/tests)](https://rubygems.org/gems/config)
[![Tests](https://github.com/rubyconfig/config/workflows/tests/badge.svg)](https://github.com/rubyconfig/config/actions?query=branch%3Amaster)
-[![Maintainability](https://api.codeclimate.com/v1/badges/85c206c13dce7de090af/maintainability)](https://codeclimate.com/github/rubyconfig/config/maintainability)
-[![Test Coverage](https://api.codeclimate.com/v1/badges/85c206c13dce7de090af/test_coverage)](https://codeclimate.com/github/rubyconfig/config/test_coverage)
[![Financial Contributors on Open Collective](https://opencollective.com/rubyconfig/all/badge.svg?label=backers)](https://opencollective.com/rubyconfig)
## Summary
Config helps you easily manage environment specific settings in an easy and usable manner.
@@ -476,9 +476,53 @@
```ruby
Settings.section.server_size # => 1
Settings.section.server # => 'google.com'
Settings.section.ssl_enabled # => false
+```
+
+### Working with AWS Secrets Manager
+
+It is possible to parse variables stored in an AWS Secrets Manager Secret as if they were environment variables by using `Config::Sources::EnvSource`.
+
+For example, the plaintext secret might look like this:
+
+```json
+{
+ "Settings.foo": "hello",
+ "Settings.bar": "world",
+}
+```
+
+In order to load those settings, fetch the settings from AWS Secrets Manager, parse the plaintext as JSON, pass the resulting `Hash` into a new `EnvSource`, load the new source, and reload.
+
+```ruby
+# fetch secrets from AWS
+client = Aws::SecretsManager::Client.new
+response = client.get_secret_value(secret_id: "#{ENV['ENVIRONMENT']}/my_application")
+secrets = JSON.parse(response.secret_string)
+
+# load secrets into config
+secret_source = Config::Sources::EnvSource.new(secrets)
+Settings.add_source!(secret_source)
+Settings.reload!
+```
+
+In this case, the following settings will be available:
+
+```ruby
+Settings.foo # => "hello"
+Settings.bar # => "world"
+```
+
+By default, `EnvSource` will use configuration for `env_prefix`, `env_separator`, `env_converter`, and `env_parse_values`, but any of these can be overridden in the constructor.
+
+```ruby
+secret_source = Config::Sources::EnvSource.new(secrets,
+ prefix: 'MyConfig',
+ separator: '__',
+ converter: nil,
+ parse_values: false)
```
## Contributing
You are very warmly welcome to help. Please follow our [contribution guidelines](CONTRIBUTING.md)