Skip to Content
CLI Referencenkapp env

nkapp env

Manage and synchronize environment variables across local .env files and remote secret providers.

nkapp env <subcommand> [options]

Subcommands

env sync

Synchronize environment variables between a local .env file and the remote secret store configured in nanokit.yml. Nanokit compares the local file against the configuration’s secrets: and env: blocks, then displays a diff of what would change. On a live run it merges pulled secrets directly into the .env file.

nkapp env sync [-e <env>] [--direction <direction>] [--dry-run] [--force]
FlagTypeDefaultDescription
-e, --env <env>stringlocalTarget environment
--direction <direction>push | pull | bothbothSync direction
--dry-runbooleanfalseShow what would change without applying anything
--forcebooleanfalseOverwrite existing values without prompting

Sync directions

DirectionBehaviour
pullResolve remote secrets / vault references and write them into the local .env file
pushUpload local .env values to the remote secret provider (requires provider support)
both (default)Runs pull and push together, highlighting any conflicts
# See what would change for staging without touching files nkapp env sync -e stage --dry-run # Pull resolved secrets from vault into .env.stage nkapp env sync -e stage --direction pull # Bidirectional sync with force-overwrite nkapp env sync -e prod --direction both --force

[!NOTE] Push is Vault-only. sync --direction push writes local values back to keys that reference HashiCorp Vault (vault://…). Variables backed by env:// references or brand-new local keys have no remote target and are reported as skipped — they are never uploaded anywhere.


env list

Display all environment variables visible to a given environment — from the local .env file, the nanokit.yml secrets: block, and each service’s env: block.

nkapp env list [-e <env>]
FlagTypeDefaultDescription
-e, --env <env>stringlocalTarget environment

Secret references (vault://… or env://…) are shown in a distinct colour so you can immediately see which values are resolved locally versus pointing at a remote store.

# Show all variables for the local environment nkapp env list # Show all variables for the staging environment nkapp env list -e stage

Relationship to Other Commands

NeedCommand
Set a project-level variable in nanokit.ymlnkapp config set env.KEY=VALUE
Set a service-level variablenkapp service set <name> env.KEY=VALUE [-e <env>]
Manage secret store referencesnkapp secrets
Show diff before syncingnkapp env sync --dry-run