Aws Config Provider
Flexible Config Provider for e.g. AWS Parameter Store/Secrets Manager
Fetch your configuration at the start of the application from AWS Parameter Store or the Secrets Manager. The format of your secrets can be json/toml or any other format. There's also flexibility in how the secrets are applied to your config.
Installation
The package can be installed by adding ext_config_provider to your list of dependencies in mix.exs:
def deps do
[
{:ext_config_provider, "~> 1.0.1"}
]
endThe AWS Parameter Store/Secrets Manager are packaged config providers. They need ExAws to be configured and have the right IAM permissions to work.
Adding a config provider
def project do
[
app: :example,
...
releases: [
example: [
config_providers: [{ExtConfigProvider, [path: "parameter_name"]}]
]
]
]
end
The config provider can take several options. See ExtConfigProvider.init/1
A macro can also be used to build a config provider
defmodule Example.ConfigProvider do
use ExtConfigProvider,
parser: ExtConfigProvider.Parser.String,
transformer: ExtConfigProvider.Transformer.Value,
merge_strategy: ExtConfigProvider.MergeStrategy.Path,
config_path: [:app, :secret]
endYou can add this config provider in the usual fashion:
releases: [
example: [
config_providers: [{Example.ConfigProvider, [path: "parameter_name"]}]
]
]Inspired by https://github.com/christopherlai/secrets_manager_provider
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ext_config_provider.