ConfigValidator

Build StatusHex VersionInline docs

Configuration validation for Mix config files.

Why

When you set a Mix configuration value equal to an environment variable, that variable must be present at compile time or in your deployment environment for your app to function properly.

It's easy to forget to do this, causing unecessary bugs. ConfigValidator gives you the tools to prevent that from ever happening again.

How

ConfigValidator reads your config/config.exs file (or other config file of your choosing), and looks for nil settings.

It is smart enough to understand both of the following ways of referencing an ENV variable:

System.get_env("VAR_NAME")
{:system, "VAR_NAME"}

If a nil setting is found, ConfigValidator can raise an error at compile time, start up, or just log a warning. It's up to you.

See the Hex Docs for more information.

Installation

Add config_validator to your list of dependencies in mix.exs:

def deps do
  [
    {:config_validator, "~> 0.1.2"}
  ]
end