Env
Config & IO
Process environment variables for the BEAM target.
Use load / loadFrom with Env.Decode to read a .env file and decode it into your own type. Existing process variables are not overridden.
parse is implemented with Parser.
Values
get
get : String -> Maybe StringLook up an environment variable by name.
Returns Nothing when the variable is unset.
Examples
Env.get "PORT"set
set : String -> String -> ()Set an environment variable in the current OS process.
Examples
Env.set "PORT" "3000"unset
unset : String -> ()Unset an environment variable.
Examples
Env.unset "PORT"all
all : Dict String StringAll environment variables as a dictionary.
Examples
Env.alldecode
decode : Decoder a -> Result String aDecode the current process environment (no file read).
Examples
Env.decode configDecoderparse
parse : String -> Dict String StringParse dotenv text into a dictionary without changing the process environment.
Examples
Env.parse "PORT=3000\n"load
load : Decoder a -> Result String aRead .env from the working directory, merge unset keys into the process environment, then decode with the given decoder.
Examples
Env.load configDecoderloadFrom
loadFrom : String -> Decoder a -> Result String aLike load, but reads the given file path instead of .env.
Examples
Env.loadFrom ".env.local" configDecoder