Expand description
Environment variable formatting and injection utilities.
Provides format functions for rendering vault secrets as shell-evaluable env
assignments (export KEY="value"), GitHub Actions workflow commands, and
PowerShell syntax. Also implements the exec env-injection path: building a
child-process environment that strips sensitive tsafe-internal vars before
adding vault secrets.
Constants§
- MINIMAL_
ENV_ VARS - Minimal set of parent env vars that most commands need for basic operation.
Functions§
- clean_
env_ command - Build a command from a clean environment, adding back only
keep, then vault secrets. - command_
with_ secrets - Build a command with the inherited parent env (minus sensitive strips) plus vault secrets.
- command_
with_ secrets_ and_ extra_ strips - Build a command with the inherited parent env (minus sensitive strips and
extra_strip_names) plus vault secrets. - exec_
clean_ env - Like
exec_with_secretsbut starts from a clean environment (no parent env inherited), then adds back only thekeepentries from the parent, and finally injectssecrets. - exec_
with_ secrets - Spawn
cmd_parts[0]withcmd_parts[1..]as arguments, injectingsecretsinto its environment (on top of the inherited parent env). Returns exit code. - format_
docker_ env - Docker
--env-fileformat:KEY=VALUEper line, sorted by key. - format_
dotenv export KEY="VALUE"per line (bash/zsh source-able). Escapes backslashes, double-quotes, dollar signs, backticks, and newlines.- format_
env - KEY=VALUE per line (POSIX env assign syntax).
- format_
github_ actions - GitHub Actions format:
::add-mask::VALUEworkflow command followed byKEY=VALUEfor each secret, sorted by key. - format_
json - JSON object
{ "KEY": "VALUE", … }. - format_
powershell $env:KEY = "VALUE"per line (PowerShell source-able). Escapes double-quotes, backticks, dollar signs, and newlines for safe evaluation.- format_
toml - TOML flat top-level table:
KEY = "VALUE"per line, sorted by key. - format_
yaml - YAML mapping: one
KEY: "VALUE"per line, sorted by key. - is_
dangerous_ injected_ env_ name - Returns true if this env var name is known to affect loaders or interpreters (ASCII case-insensitive).
- parse_
dotenv - Parse a
.envfile into aHashMap. Handles#comments, blank lines, Parse a.env-style file into a key→value map. - sensitive_
parent_ env_ vars - Returns the list of parent environment variable names that
tsafe execstrips before spawning the child process, including config-driven extras. Used by--planto show which names would be scrubbed.