# glm_stackable_config

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

```sh
gleam add glm_stackable_config
```
```gleam
import glm_stackable_config as gsc
import tom

pub fn main() -> Nil {

  // merge config3 onto config2 onto config1
  use wibble_toml <- result.try({
    "config1.toml"
    |> tom.parse
    |> gsc.merge(tom.parse("config2.toml")) // config2 values overwrite config1
    |> gsc.merge(tom.parse("config3.toml")) // config3 values overwrite config2
  })

  // TODO: provide better examples
  // define some cool base configs and then
  // reference them in subsequent configs
  use base <- result.try(tom.parse("base.toml"))
  use wobble_toml <- result.try({
    gsc.rebase(base, tom.parse("configX.toml"))
  })

  // now either transform the toml into a gleam record, or use
  // it directly via tom.get_{int|float|string|bool}() functions.

  // see tests for further use cases
}
```

Further documentation can be found at <https://glm-stackable-config.hexdocs.pm/>.

## Development

```sh
gleam run   # Run the project
gleam test  # Run the tests
```
