TOML Config Provider v0.1.0 TomlConfigProvider View Source

A config provider to read TOML configuration files that works with Elixir (1.9+) releases.

Usage

Update the release configuration in your mix.exs file:

You can either give a fully qualified pathname to the config file.

releases: [
  my_app: [
    config_providers: [
      {TomlConfigProvider, path: "/absolute/path/to/my/config.toml"}
    ],
    ...
  ]
]

Or you can read the config directory or path from a specified environment variable. Booting the application fails if the specified environment variable is undefined.

releases: [
  my_app: [
    config_providers: [
      {TomlConfigProvider,
       path: {:system, "RELEASE_CONFIG_DIR", "my_app.toml"}}
    ],
    ...
  ]
]

Or:

releases: [
  my_app: [
    config_providers: [
      {TomlConfigProvider, path: {:system, "RELEASE_CONFIG_PATH"}}
    ],
    ...
  ]
]

All config provider options except :path are forwarded to Toml.decode_file/2. Thus, you can also provide custom transforms.

config_providers: [
  {TomlConfigProvider,
   path: "path/to/my/config.toml",
   transforms: [UrlTransform, TupleTransform]}
]