Doppler ConfigProvider for Elixir projects.
The package can be installed by adding :doppler_config_provider to your list of dependencies in mix.exs:
def deps do
[
{:doppler_config_provider, "~> 0.4.2"},
# Mojito is optional, but it is the default if you don't specify `:http_module` in options.
{:mojito, "~> 0.7.10"},
]
end- Generate a service token.
- Add necessary config.
- Add the config provider to
releaseconfig inmix.exs.
:service_token(required) - The Doppler service token.:http_module(optional) - The HTTP client module. Defaults to{Mojito, :mojito}. Should implementDopplerConfigProvider.HTTPClientbehaviour.:json_module(optional) - The JSON decoding module. Defaults to{Jason, :jason}or{Poison, :poison}. Should implementDopplerConfigProvider.JSONDecoderbehaviour.:mappings(required) - A map specifying how to translate the Doppler config to application config.
The :http_module and :json_module options can take either a module (e.g. MyApp.Foobar) or a tuple with the module
and the apps that need to be started for the module to work properly (e.g. {MyApp.Foobar, :mojito} or {MyApp.Foobar, [:tesla, :hackney]}).
config :doppler_config_provider,
service_token: System.fetch_env!("DOPPLER_TOKEN"),
mappings: %{
"DATABASE_URL" => [:my_app, MyApp.Repo, :url],
"SECRET_KEY_BASE" => [:my_app, MyAppWeb.Endpoint, :secret_key_base],
"STRIPE_SECRET_KEY" => [:stripity_stripe, :api_key],
}releases: [
my_app: [
# ...
config_providers: [
{DopplerConfigProvider, http_module: {MyDopplerHTTPClient, [:tesla, :hackney]}}
]
]
],Notes:
- The options provided to the config provider in
releasesare merged with the config provided in your config files. The options passed inmix.exstake precedence.
Copyright 2021 Ryan Winchester
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.