ConfigExt
A bunch of common elixir config helpers to load config from environment variables or by executing a function. Part of the work was based on gist from bitwalker and community practises (especially for using {:system, "VAR"[, default]}
spec).
Installation
The package can be installed as:
Add
config_ext
to your list of dependencies inmix.exs
:def deps do [{:config_ext, "~> 0.1.0"}] end
Use module to fetch config from env var
# where LEVEL=debug config :logger, :level, {:system, "LEVEL", "info"} ConfigExt.get_env(:logger, :level) # => "debug"
or evaluate a function on runtime
config :logger, :level, {:function, YourModule, :function_name, [:arg1, :arg2]} ConfigExt.get_env(:logger, :level) # => YourModule.function_name(:arg1, :arg2)