Assert the type of a environment variable at compile time.
def deps do
[
{:assert, git: "https://github.com/nicholasbair/assert-env.git"}
]
end
- Add a file to project root,
assertions.txt
- In
assertions.txt
, add your assertions (one per line, no empty lines)
- SOME_VAR is not nil
- SOME_VAR is type float
- SOME_VAR is type integer
- SOME_VAR is type string
- SOME_VAR is type boolean
Run assertions at compile time (cause the build to fail without the correct environment variables) by adding a module:
defmodule MyModule.Assert do
Assert.init()
end