CLI Configuration
Config File
The CLI stores local preferences in:
text
~/.chainabit/config.jsonTypical shape:
json
{
"apiUrl": "https://api.chainabit.com/api/v1",
"token": "<redacted>",
"workspaceId": "ws_123"
}The config directory is created with restrictive permissions and the config file is written with user-only access when the filesystem supports POSIX permissions. The token is still plaintext on disk, so treat ~/.chainabit/config.json like any other local secret.
Environment Variables
CHAINABIT_BASE_URLAPI base URLCHAINABIT__API_BASE_URLAPI origin or base URL for environments that expose only the originCHAINABIT_TOKENaccess token overrideCHAINABIT_DEVELOPER_TOKENdeveloper token used withchainabit auth login --token-envCHAINABIT_WORKSPACE_IDdefault workspace overrideCHAINABIT_APP_BASE_URLbrowser app base for device/browser auth linksCHAINABIT_ENV_FILEtrusted env file to load before command execution
Sign-In Behavior
- Interactive sessions default to browser/device login.
- Use
--token-stdin,--token-env, or--token-filefor non-interactive scripts and CI jobs. - Identifier/password login is a browser-oriented compatibility path and should not be the default automation strategy.
- Use
--deviceor--browserto force the browser-based flow. - Use
--no-openwhen you want to open the returned URL manually.
Workspace Precedence
Workspace context is resolved in this order:
- command-specific overrides such as
chao --workspace CHAINABIT_WORKSPACE_ID~/.chainabit/config.json- built-in defaults
If you want to pin the workspace locally, run:
bash
chainabit workspace use ws_123Env File Loading
The CLI resolves env files in this order:
--env-file <path>CHAINABIT_ENV_FILE.env.productionwhenNODE_ENV=production.env.localfor non-production runs.env
Common Setup
bash
export CHAINABIT_BASE_URL="https://api.chainabit.com/api/v1"
export CHAINABIT_WORKSPACE_ID="ws_123"
export CHAINABIT_DEVELOPER_TOKEN="cbt_live_..."
chainabit auth login --token-env CHAINABIT_DEVELOPER_TOKEN
chainabit workspace current