secrets_cache v0.1.0 SecretsCache
Documentation for SecretsCache.
A cache and merger for AWS secrets, with handling for embedded keys
Link to this section Summary
Functions
Get the config associated with an otp app, and merge in the config described by the secret
Force loading of a secret from the network, even if we have a cached version available, then put that value back in the cache.
Link to this section Functions
get_config(otp_app, secret_name, opts \\ [region: "eu-west-1"])
Get the config associated with an otp app, and merge in the config described by the secret
For example, if your secret looks like
{"database": {"username": "abc", "password": "fff"}, apikey: "123"}
And your OTP app is configured as such
config :my_app,
nice: "meme"
You can call
iex> get_config(:my_app, "database_secret")
[database: [username: "abc", password: "fff"], nice: "meme"]
Will use the cached secret if available. Use reload_secret2
if you need
to refresh whilst running.
reload_secret(name, opts \\ [region: "eu-west-1"])
Force loading of a secret from the network, even if we have a cached version available, then put that value back in the cache.
Useful if your secret rotates or otherwise changes
iex> reload_secret("my_secret")
{:ok, "some_value"}