Skip to content

envpkt env (add / edit / rm / rename / alias)

CRUD subcommands for [env.*] entries — the plaintext, non-secret environment defaults that live in envpkt.toml. For scan / check / export workflows, see envpkt env scan, envpkt env check, and envpkt env export.

Terminal window
envpkt env add <name> <value> [options]
envpkt env edit <name> [options]
envpkt env rm <name> [options]
envpkt env rename <old> <new> [options]
envpkt env alias <name> --from env.<TARGET> [options]

Create a new [env.<name>] block with a plaintext default value. Errors if <name> already exists.

OptionDescription
-c, --config <path>Path to envpkt.toml
--purpose <text>Why this env var exists
--comment <text>Free-form annotation
--tags <pairs>Comma-separated key=value tags
--dry-runPreview the TOML block without writing
Terminal window
envpkt env add NODE_ENV production --purpose "Runtime mode"
envpkt env add LOG_LEVEL info --comment "Override to 'debug' locally"

Update fields on an existing env entry.

OptionDescription
-c, --config <path>Path to envpkt.toml
--value <text>New default value
--purpose <text>Update purpose
--comment <text>Update comment
--tags <pairs>Replace tags (comma-separated key=value)
--dry-runPreview the changes without writing
Terminal window
envpkt env edit LOG_LEVEL --value warn
envpkt env edit NODE_ENV --purpose "Application runtime mode (deprecated — use APP_ENV)"

Remove an env entry from the file.

OptionDescription
-c, --config <path>Path to envpkt.toml
--dry-runPreview the result without writing
Terminal window
envpkt env rm LEGACY_FLAG

Rename an env entry, preserving all fields.

OptionDescription
-c, --config <path>Path to envpkt.toml
--dry-runPreview the result without writing
Terminal window
envpkt env rename NODE_ENV APP_ENV

Create an alias entry that reuses another env entry’s resolved value. Useful for exposing the same configuration default under multiple canonical names. See Aliases for the feature overview.

OptionDescription
--from <ref>Required. Target reference, must be env.<KEY>
-c, --config <path>Path to envpkt.toml
--purpose <text>Why this alias exists (local metadata)
--comment <text>Free-form annotation
--tags <pairs>Comma-separated key=value tags
--forceOverwrite the entry if <name> already exists
--dry-runPreview the TOML block without writing
Terminal window
# Basic alias — LEGACY_URL resolves to SERVICE_URL's value
envpkt env alias LEGACY_URL --from env.SERVICE_URL
# With local metadata
envpkt env alias LEGACY_URL \
--from env.SERVICE_URL \
--purpose "Legacy name kept for backwards compatibility"
# Overwrite protection — without --force, warns and exits if name exists
envpkt env alias LEGACY_URL --from env.SERVICE_URL --force
CaseBehavior
--from missing or not env.<KEY>Exit with error
--from points at a secret.* entryReject — use envpkt secret alias for secret aliases
Target doesn’t exist in configReject — add the target env entry first
Target is itself an aliasReject — chained aliases are not supported
<name> equals the target keyReject — self-reference
<name> already exists without --forceWarn and exit; report whether existing entry was regular or another alias

At runtime the load-time validator re-checks these rules, so configs hand-edited to bypass the CLI checks still fail to boot with a clear AliasError (see Error Types).

  • [env.*] entries hold non-secret plaintext defaults. For credentials, use envpkt secret and seal the values with envpkt seal.
  • Every subcommand supports --dry-run to preview the resulting file without writing.
  • -c, --config <path> defaults to the standard discovery chain (CWD → ENVPKT_CONFIG~/.envpkt/ → cloud storage).