ConfigExt: Common configuration helpers


I’ve created ConfigExt lib for handling some common case scenarios when working with configuration.


I’ve been looking for some lib that correctly handles {:system, "VAR"} and a more robust options like for example executing a function on runtime. So far there were only some gists for copy/paste, so I’ve wrapped them plus I’ve also added pattern for function execution, i.e. like

System.put_env "BAR", "baz"
defmodule MyApp do
  def meta, do: [foo: System.get_env("BAR"), env: "staging"]

config :logger, metadata: {:function, MyApp, :meta}

ConfigExt.fetch_env :logger, :metadata
# => [foo:  "baz", env: "staging"]

Let me know what do you think. (personally I would rather see it as part of elixir Application module rather than a separate lib)


Nice features! I like how you can define the environment default in the config too! And runtime function call is awesome.