nicholasbair / assert-env

Assert the data type of environment variables at compile time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assert

Assert the type of a environment variable at compile time.

Installation

def deps do
  [
    {:assert, git: "https://github.com/nicholasbair/assert-env.git"}
  ]
end

Usage

  1. Add a file to project root, assertions.txt
  2. In assertions.txt, add your assertions (one per line, no empty lines)

Supported Assertions

  • 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

Provisions for Compile time

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

About

Assert the data type of environment variables at compile time

License:Apache License 2.0


Languages

Language:Elixir 100.0%