Skip to content

Environment Variables

CACD uses these environment variables for configuration.

VariableDescriptionDefault
CACD_CONFIG_DIRCustom config directory path~/.config/cacd
CACD_PORTPort for the web interface(from config)
CACD_DEVEnable dev mode (uses .cacd-dev/ in current dir)unset

Override the default config directory. Useful if you want to keep CACD config in a different location.

Terminal window
export CACD_CONFIG_DIR=/path/to/custom/config
cacd

Set the web interface port without using the --port flag.

Terminal window
export CACD_PORT=8080
cacd

Note: The --port flag takes priority over this variable.

When set to 1, CACD uses .cacd-dev/ in the current directory instead of the global config. Useful for development.

Terminal window
export CACD_DEV=1
cacd

These variables are available to hooks (status hooks, worktree hooks, project scripts).

VariableDescription
CACD_WORKTREE_PATHPath to the session’s worktree
CACD_WORKTREE_BRANCHBranch name
CACD_GIT_ROOTGit repository root
CACD_SESSION_IDSession identifier
CACD_OLD_STATEPrevious state (idle, busy, waiting_input)
CACD_NEW_STATENew state
VariableDescription
CACD_WORKTREE_PATHPath to the new worktree
CACD_WORKTREE_BRANCHBranch name
CACD_GIT_ROOTGit repository root
CACD_BASE_BRANCHBranch the worktree was created from
VariableDescription
CACD_ROOT_PATHGit repository root
CACD_WORKTREE_PATHPath to the worktree
CACD_WORKTREE_NAMEWorktree name
CACD_BRANCHBranch name

For port configuration:

  1. --port flag (highest priority)
  2. CACD_PORT environment variable
  3. Config file setting
  4. Default: 3000

For config directory:

  1. CACD_CONFIG_DIR (highest priority)
  2. CACD_DEV=1 (uses .cacd-dev/)
  3. Default: ~/.config/cacd