Last active
April 18, 2019 11:53
-
-
Save jfornoff/72e455b5442383bf8d9ef95a5fab7e22 to your computer and use it in GitHub Desktop.
Distillery config provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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