# Atmo - Environment Configuration for Elixir
[![Build Status](https://travis-ci.org/vinli/atmo_ex.svg?branch=master)](https://travis-ci.org/vinli/atmo_ex)
[![Hex.pm](https://img.shields.io/hexpm/v/atmo.svg)](https://hex.pm/packages/atmo)
A single, flexible interface for reading configuration from environment variables or
`Mix.Config` with parsing and defaults.
## Installation
```elixir
defp deps do
[{:atmo, "~> 0.1.0"}]
end
```
## Usage
**[Full Documentation](https://hexdocs.pm/atmo/Atmo.html)**
The `Atmo` module provides a single interface for retrieving configuration from
multiple sources. This is most useful for development of applications where
config files are useful in testing and development but must be overridden by
environment variables in production.
### Basic Usage
```elixir
Mix.Config.config(:some_app, app_conf: "bar")
System.put_env("ENV_VAR", "foo")
Atmo.get("ENV_VAR") # => "foo"
Atmo.get(:app_conf) #=> "bar"
Atmo.get("MISSING_VARIABLE") # => nil
Atmo.get("MISSING_VARIABLE", "whatever") # => "whatever"
Atmo.get("env_var") # => "foo"
Atmo.get("env_VAR") # => "foo"
Atmo.get(:env_var) # => "foo"
Atmo.get(:ENV_VAR) # => "foo"
```
### Type Parsing
```elixir
System.put_env("SOME_FLOAT", "1.234")
System.put_env("SOME_INT", "42")
Atmo.get("SOME_INT") #=> "42"
Atmo.get_integer("SOME_INT") #=> 42
Atmo.get_float("SOME_FLOAT") #=> 1.234
```
## Tests
```bash
> mix test
```