README.md

# dotenv_conf

Easy configurations from environment variables and .env files.

[![Package Version](https://img.shields.io/hexpm/v/dotenv_conf)](https://hex.pm/packages/dotenv_conf)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/dotenv_conf/)

dotenv_conf uses environment variables by default, and if they do not exist, look at whether the value is defined in a .env file.  
That simplifies the dev process while allowing [12-factor configuration](https://12factor.net/config) for other environments.

## Quick start

```sh
gleam add dotenv_conf
```
```gleam
import dotenv_conf

type Context {
  Context(
    database_path: String,
    application_port: Int
  )
}

pub fn main() {
  use file <- dotenv_conf.read_file(".env")
  let context = Context(
    database_path: dotenv_conf.read_string_or("DB_PATH", file, "[memory]"),
    application_port: dotenv_conf.read_int_or("PORT", file, 8000)
  )

  // use the context after that
}
```

Further documentation can be found at <https://hexdocs.pm/dotenv_conf>.

## Roadmap

- Quotes
- Interpolation
- Multi-line values
- Escape sequences