Module Kwapp.Env

module Env: sig .. end
Environment Variables


You can define environment variables used by your program via an env list; this list can be passed to help, usagestring, usage and helpaction and the help message for your program will then list these variables, their defaults and descriptions neatly.

Also. the Kwapp.Env.env function can be used to return the value of an environment variable, with defaults from your env list.

type env = string * (string option * string) 
The type of environment variables.

An env is a pair, consisting of the environment variable name (as a key) and a pair consisting of it's default value (if any) and a brief one-line description for the application help message.

val env : (string * (string * 'a)) list -> ?def:string -> string -> string
env envs ?def var: return value of an env var, or its default if it's unset.

Can be used for any env var, but if the var isn't in the envs list, there is no default unless you give ?def.
Raises Not_found if no such var in environment nor any default in envs