Skip to main content

Module env

Module env 

Source
Expand description

Environment and .env file handling.

Enums§

EnvrcStatus
Status of .envrc after writing.

Functions§

dotenv_has_murk_key
Check whether .env already contains a MURK_KEY line.
parse_env
Parse a .env file into key-value pairs. Skips comments, blank lines, MURK_* keys, and strips quotes and export prefixes.
read_key_from_dotenv
Read MURK_KEY from .env file if present.
resolve_key
Resolve the secret key from MURK_KEY or MURK_KEY_FILE. MURK_KEY takes priority; MURK_KEY_FILE reads the key from a file. Returns the key wrapped in SecretString so it is zeroized on drop.
warn_env_permissions
Warn if .env has loose permissions (Unix only).
write_envrc
Write a .envrc file for direnv integration.
write_key_to_dotenv
Write a MURK_KEY to .env, removing any existing MURK_KEY lines. On Unix, sets file permissions to 600 atomically at creation time to prevent a TOCTOU window where the secret key is world-readable. On non-Unix platforms, permissions are not hardened.