Environments

Manage development, staging, and production contexts

Creating Environments

Terminal

configsync env create dev --tier development --color "#22c55e"

configsync env create staging --tier staging --color "#f59e0b"

configsync env create prod --tier production --color "#ef4444" --protect

--tier <tier>One of: development, staging, production, custom
--color <hex>Hex color used for terminal effects and prompt
--protectEnable protection (requires typing the name to confirm destructive actions)

Activating Environments

Terminal

# Activate an environment

configsync env activate staging

# See current environment

configsync env current

# Deactivate

configsync env deactivate

# List all environments

configsync env list

Environment Shell

Spawn a sub-shell with a specific environment active. When you exit the shell, the environment reverts.

Terminal

configsync env shell staging

Shell Prompt Integration

Add environment info to your shell prompt with the env hook command.

~/.zshrc

eval "$(configsync env hook zsh)"

~/.bashrc

eval "$(configsync env hook bash)"

Exporting Variables

Use env vars to output export statements for the active environment, useful for piping into scripts.

Terminal

configsync env vars

# Use in a script

eval "$(configsync env vars)"

Resolution Priority

ConfigSync resolves the active environment in this order (first match wins):

  1. --env flag passed to the command
  2. CONFIGSYNC_ENV environment variable
  3. .configsync-env file in current or parent directories
  4. ~/.configsync/active-env global setting

Terminal Effects

Each tier applies visual cues to your terminal to reduce the risk of running commands in the wrong environment. Effects include background tint and status bar indicators, colored by the environment's configured color.

Protection Levels

Protection levels are determined by tier and the --protect flag:

TierBehavior
developmentNo confirmation required
stagingPrompts for yes/no confirmation
production (protected)Must type the environment name to confirm
!
Protected environments require you to type the full environment name before any destructive operation like push or pull --force.

Deleting Environments

Terminal

configsync env delete staging