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
Link to this function
load(opts) View Source
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 asecrets.yml
file in your projects root directory.:keys
- A list of string keys within theyml
file to use for the secrets. By default this is just the value fromMix.env/0
.
Example
Exenv.Adapters.Yaml.load(file: "/path/to/file.yml", keys: ["common", "dev"])