exenv_yaml v0.3.0 Exenv.Adapters.Yaml View Source

Loads env vars from .yml files.

You can use this adapter by adding it to your :exenv application config. The options available can be seen in the load/1 function.

config :exenv,
  adapters: [
    {Exenv.Adapters.Yaml, []}
  ]

Below is a simple example of a .yml file:

prod:
  key1: val
  key2: val

dev:
  key1: val
  key2: val

test:
  key1: val
  key2: val

Assuming we have the above file in our project root directory, we would be able to access any of the above environment vars.

System.get_env("KEY1")

Link to this section Summary

Functions

Loads the system env vars from a .yml specified in the options

Link to this section Functions

Loads the system env vars from a .yml specified in the options.

Options

  • :file - The file path in which to read the .yml from. By default this is a secrets.yml file in your projects root directory.
  • :keys - A list of string keys within the yml file to use for the secrets. By default this is just the value from Mix.env/0.

Example

Exenv.Adapters.Yaml.load(file: "/path/to/file.yml", keys: ["common", "dev"])