Skip to content

Commit 264bb0a

Browse files
committed
Updated readme
1 parent e2afb99 commit 264bb0a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ This gem expects your secret value to be a JSON object. The only required key is
3434
* `ttl` - Time to live in seconds. Describes how long the secret should live in in-memory cache.
3535
* `encoding` - Currently, only `base64` is supported as a value. If your `value` is base64 encoded, this will result in a returned secret that is base64 decoded.
3636

37+
### Configuration
38+
The follow ENV vars are expected:
39+
`AWS_SECRETS_ENV` - preceeds all path lookups, ex: `dev`, `staging`, `qa`, `production`
40+
`AWS_SECRETS_KEY` - AWS IAM access key
41+
`AWS_SECRETS_SECRET` - AWS IAM access secret
42+
43+
The manager should be created at boot time, in an initializer for example, and stored as a constant or global.
44+
```
45+
$secrets = SecretsManager.new
46+
```
47+
48+
### Lookup
49+
```
50+
$secrets.fetch('services/twilio/api-key')
51+
$secrets['services/twilio/api-key']
52+
```
53+
3754
## Development
3855

3956
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

lib/secrets-manager.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ def find(path)
3333
class Manager
3434
attr_reader :cache
3535

36-
def initialize(client = nil)
36+
def initialize(client: nil)
3737
@cache = Cache.new
3838
@aws_client = client
39-
end
4039

4140
def secret_env
4241
ENV.fetch('AWS_SECRETS_ENV', 'dev'),

0 commit comments

Comments
 (0)