Skip to content

Instantly share code, notes, and snippets.

@jfornoff
Last active April 18, 2019 11:53
Show Gist options
  • Save jfornoff/72e455b5442383bf8d9ef95a5fab7e22 to your computer and use it in GitHub Desktop.
Save jfornoff/72e455b5442383bf8d9ef95a5fab7e22 to your computer and use it in GitHub Desktop.
Distillery config provider
defmodule EnvironmentConfigProvider do
use Mix.Releases.Config.Provider
@impl Provider
def init(%{env_var_name: var_name, persist: [app, config_variable]}) do
value = System.get_env(var_name) || raise "No value provided for ENV variable #{var_name}"
Application.put_env(app, config_variable, value, persistent: true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment