Last active
February 20, 2018 22:58
-
-
Save AndrewDryga/76a8ad81b987309910430858e4d5870b to your computer and use it in GitHub Desktop.
Adding runtime config via Application.put_env/2 in Application start/2 callback
This file contains hidden or 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 Sample.Application do | |
use Application | |
# ... | |
def start(_type, _args) do | |
import Supervisor.Spec | |
# ... | |
# Update application environment from system environment variable when application starts | |
Application.put_env(:sample_app, :configurable_env_var, System.get_env("CONFIGURABLE_ENV_VAR")) | |
# ... | |
Supervisor.start_link(children, opts) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment