March Docs

Env

Env module: environment variable access for application configuration.

Env.get/2 reads an env var, returning a default String if not set. Env.require/1 reads a required env var, panicking if absent. Env.get_int/2 and Env.get_bool/2 parse the raw string into typed values.

These are the primitives used in config/runtime.march files to build environment-specific configuration at application startup.

Usage: Env.get("PORT", "4000") -- "4000" (or env value) Env.require("SECRET_KEY_BASE") -- panics if not set Env.get_int("PORT", 4000) -- 4000 (parsed as Int) Env.get_bool("DEBUG", false) -- false (or true if "true"/"1"/"yes")

Functions

fngetget(name, default)#

Read an environment variable. Returns default if not set.

fnrequirerequire(name)#

Read a required environment variable. Panics if not set.

fnget_intget_int(name, default)#

Read an environment variable and parse it as Int. Returns default if not set or not a valid integer.

fnget_boolget_bool(name, default)#

Read an environment variable and parse as Bool. "true", "1", "yes" are true; all other values (including absent) use default.

fnis_setis_set(name)#

Return true if the environment variable is set to any value.

fnrequire_intrequire_int(name)#

Read a required environment variable and parse it as Int. Panics if not set or not a valid integer.