Configuration
Config files, environment variables, and resolution order
The BuildBear CLI uses two configuration files: a global user config for your API key, and an optional per-project config that stores your sandbox connection details.
Global user config
Location: ~/.config/buildbear/config.json
Permissions: 0600 (user read/write only — set automatically by the CLI)
Format:
This file is created by buildbear auth setup or buildbear auth login and deleted by buildbear auth logout.
You should never edit this file manually — use the auth commands instead.
Project config (.buildbear.json)
Location: .buildbear.json in the current working directory
Created by buildbear init. Stores your sandbox connection details so that commands which accept an optional [rpcUrl] argument don't require one.
Format:
Fields:
| Field | Description |
|---|---|
rpcUrl | RPC endpoint for the sandbox |
network | Human-readable network name |
chainId | Chain ID of the network that was forked |
forkChainId | Chain ID inside the sandbox (may differ if --chain-id was used during creation) |
explorerUrl | Block explorer URL for the sandbox |
Commands that read this file: buildbear status, buildbear faucet native, buildbear faucet erc20, buildbear snapshot take, buildbear snapshot revert, buildbear rpc.
Environment variables
| Variable | Description | Precedence |
|---|---|---|
BUILDBEAR_API_KEY | API key for authentication | Overrides config file |
Setting BUILDBEAR_API_KEY is the recommended approach for CI/CD pipelines:
Authentication priority
When a command needs to authenticate, the CLI checks in this order:
BUILDBEAR_API_KEYenvironment variable~/.config/buildbear/config.json
If neither is present, the command exits with:
RPC URL resolution priority
When a command accepts an optional [rpcUrl] argument, it resolves the URL in this order:
- Explicit
rpcUrlargument passed on the command line rpcUrlfield in.buildbear.jsonin the current directory
If neither is found, the command exits with:
Gitignore recommendations
.buildbear.json contains a personal sandbox URL. Whether to commit it depends on your team's workflow:
- Commit it if your team shares a single sandbox
- Gitignore it if each developer uses their own sandbox
To ignore it: