Skip to content

bhatti setup

Configure the CLI’s API endpoint and key.

bhatti setup [—url URL] [—token KEY]

Writes the API endpoint and key to ~/.bhatti/config.yaml and tests the connection by listing sandboxes. The auth test hits GET /sandboxes (an authenticated endpoint), so a bad key fails immediately instead of appearing to succeed.

With no flags, runs interactively — prompts for endpoint and key, masks the key as you type. With --url and --token, runs non-interactively. Use the latter form for agents, CI scripts, and provisioning tools.

You usually don’t need to run this on the server itself: the install script (curl -fsSL bhatti.sh/install | sudo bash) creates the admin user and writes the config to your $SUDO_USER’s ~/.bhatti/config.yaml automatically. Run setup on a different machine that you want to drive the server from, or to switch your local CLI to a different bhatti server.

Terminal window
bhatti setup
API endpoint [http://localhost:8080]: https://api.bhatti.sh
API key: <input is hidden>
Saved to /home/alice/.bhatti/config.yaml
Testing connection... ✓ authenticated (3 sandboxes)
Enable completions:
echo 'source <(bhatti completion zsh)' >> ~/.zshrc

Non-interactive (agents, CI, provisioners)

Section titled “Non-interactive (agents, CI, provisioners)”
Terminal window
bhatti setup --url https://api.bhatti.sh --token bht_abc123
Saved to /home/alice/.bhatti/config.yaml
Testing connection... ✓ authenticated (3 sandboxes)

The completions hint is suppressed — there’s no human reading the output anyway. If the connection test fails, the command exits non-zero so your provisioner can detect the failure.

string required

API endpoint URL. Sets the prompt’s default. With --token set too, the prompt is skipped entirely and setup writes immediately.

string required

API key. With --url set too, the prompt is skipped and setup writes immediately.

The auth test always runs. If you need to write the config without contacting a server (pre-baking an image, for example), edit ~/.bhatti/config.yaml directly — it’s just two YAML keys.

See Global flags for --url, --token (the global versions of these — they override config but don’t write to it; setup’s flags are the persisting form), --json, --timing, --data-dir.

After setup, your config looks like:

api_url: https://api.bhatti.sh
auth_token: bht_abc123def456...

At runtime, this can be overridden with --url, --token, BHATTI_URL, or BHATTI_TOKEN. See Configuration precedence.