Skip to content

CLI Configuration

Config File

The CLI stores local preferences in:

text
~/.chainabit/config.json

Typical 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_URL API base URL
  • CHAINABIT__API_BASE_URL API origin or base URL for environments that expose only the origin
  • CHAINABIT_TOKEN access token override
  • CHAINABIT_DEVELOPER_TOKEN developer token used with chainabit auth login --token-env
  • CHAINABIT_WORKSPACE_ID default workspace override
  • CHAINABIT_APP_BASE_URL browser app base for device/browser auth links
  • CHAINABIT_ENV_FILE trusted env file to load before command execution

Sign-In Behavior

  • Interactive sessions default to browser/device login.
  • Use --token-stdin, --token-env, or --token-file for non-interactive scripts and CI jobs.
  • Identifier/password login is a browser-oriented compatibility path and should not be the default automation strategy.
  • Use --device or --browser to force the browser-based flow.
  • Use --no-open when you want to open the returned URL manually.

Workspace Precedence

Workspace context is resolved in this order:

  1. command-specific overrides such as chao --workspace
  2. CHAINABIT_WORKSPACE_ID
  3. ~/.chainabit/config.json
  4. built-in defaults

If you want to pin the workspace locally, run:

bash
chainabit workspace use ws_123

Env File Loading

The CLI resolves env files in this order:

  1. --env-file <path>
  2. CHAINABIT_ENV_FILE
  3. .env.production when NODE_ENV=production
  4. .env.local for non-production runs
  5. .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

Built with purpose.