Figaro
Port of @laserlemon's Figaro project to Elixir. Please see the original project for details about how Figaro works.
Getting Started
Add Figaro as a dependency in your mix.exs file.
defp deps do
[{ :figaro, ">= 0.0.0" }]
endYou should also update your applications list to include Figaro:
def application do
[applications: [:figaro]]
end
After you are done, run mix deps.get in your shell to fetch the dependencies.
Usage
Given the following configuration file:
# config/application.yml
foo: bar
baz: qux
You will have access to configuration values via Figaro.env:
iex> Figaro.env.foo
"bar"
iex> Figaro.env.baz
"qux"
iex> Figaro.env
%{foo: "bar", baz: "qux"}
Figaro also sets ENV with values defined in application.yml:
iex> System.get_env("FOO")
"bar"
iex> System.get_env("BAZ")
"qux"Please note:ENV is a simple key/value store. All values will be converted to strings. Deeply nested configuration structures are not possible.