Logo GenPRES

Env Module

Reads the environment variables of the process, loads unset variables from a .env file and returns a text with system information.

Functions and values

Function or value Description

environmentVars ()

Full Usage: environmentVars ()

Parameters:
    () : unit

Returns: Dictionary<string, string>

Returns current process environment variables as a dictionary (portable) - Uses the current process environment only (works on all platforms) - Case-insensitive keys to avoid casing pitfalls across OSes - Does not filter out PATH or any other variable

() : unit
Returns: Dictionary<string, string>

getItem envName

Full Usage: getItem envName

Parameters:
    envName : string

Returns: String option

Get an environment variable from the current process. Returns None if the variable does not exist.

envName : string
Returns: String option

getSystemInfo ()

Full Usage: getSystemInfo ()

Parameters:
    () : unit

Returns: string
() : unit
Returns: string

loadDotEnv ()

Full Usage: loadDotEnv ()

Parameters:
    () : unit

Returns: bool

Load environment variables from a .env file. Searches upward from the current directory for a .env file. Only sets variables that are not already set in the environment, preserving the override chain: shell/CI/Docker > .env > code defaults. Returns true if a .env file was found and processed.

() : unit
Returns: bool

parseLine line

Full Usage: parseLine line

Parameters:
    line : string

Returns: (string * string) option

Parses one line of a .env file into its key and value, both trimmed and the value unquoted. The value runs from the first equals sign to the end of the line, so it can hold an equals sign itself. A blank line, a comment, a line without an equals sign and a line with an empty key give None.

line : string
Returns: (string * string) option

unquote value

Full Usage: unquote value

Parameters:
    value : string

Returns: string

Removes one pair of matching surrounding quotes, double or single, from a value. A value without them, or with a quote at one end only, is returned as it is.

value : string
Returns: string

Type something to start searching.