https://github.com/ammbot/config_env
Configuration loader from system environment
https://github.com/ammbot/config_env
elixir
Last synced: 4 months ago
JSON representation
Configuration loader from system environment
- Host: GitHub
- URL: https://github.com/ammbot/config_env
- Owner: ammbot
- Created: 2017-10-16T07:28:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-17T04:26:16.000Z (over 8 years ago)
- Last Synced: 2026-01-02T23:55:44.132Z (6 months ago)
- Topics: elixir
- Language: Elixir
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ConfigEnv
**Configuration loader from system environment**
## Why?
ensure that all system environment is set and convert to properly type.
## Installation
First, add ConfigEnv to your mix.exs dependencies:
```elixir
def deps do
[
{:config_env, "~> 0.1.0"}
]
end
```
## Usage
in `config.exs`
```elixir
config :your_app,
string: {:system, "KEY"},
atom: {:system, "ATOM"},
integer: {:system, "INTEGER", :integer},
float: {:system, "FLOAT", :float},
list: {:system, "LIST", :list}
```
it can be nested
```elixir
config :your_app,
nested: %{
key: {:system, "KEY"},
another_nested: [
key: {:system, "ANOTHER_KEY"}
]
}
```
put this code before start your app
```elixir
defmodule YourApp do
use Application
def start(_type, _args) do
ConfigEnv.load_env([:yourapp, :otherapp, ...])
# your code
end
```