Skip to content

Configure a CLI profile

What you will end up with

An active CLI profile pointing at your control plane, verified by a command that reaches it.

Prerequisites

export CP_CLI_ENDPOINT="http://127.0.0.1:18080"

1. Look at what is configured now

xratu config view

On a fresh install this prints a document with api_version of xratu.config/v2, a single default profile and current_profile set to it. The endpoint will be http://localhost:8080 unless XRATU_CP_ENDPOINT was set when the file was first created.

2. Set the endpoint and activate the profile

xratu config profile set default --endpoint "${CP_CLI_ENDPOINT}" --use

--use makes it the active profile. Without it the values are written but the CLI keeps using whichever profile was already active.

If you are switching control planes rather than configuring the first one, create a separate profile instead of editing this one, so the endpoint and its token stay together:

xratu config profile set staging --endpoint "${CP_CLI_ENDPOINT}" --use

3. Clear any stale token

A token from a previous control plane will fail in ways that look like permission problems. Clear it before authenticating:

xratu config profile set default --token "" --use

Expected output

Each command prints the resulting configuration document, showing the updated profile and which one is current.

4. Verify it worked

Confirm the profile holds what you expect:

xratu config view
xratu config get profiles

Then confirm the CLI reaches the control plane. Before authenticating, the resolved actor is the system one, which is the expected answer at this point:

xratu auth whoami

A response, even one reporting actor_id of system, proves the endpoint is reachable and the CLI is talking to a control plane. That is what this step verifies; obtaining a real identity is the next task.

5. Optional: set default scope

Once an organisation and workspace exist, storing them in the profile stops you passing them on every command:

xratu config set organization acme
xratu config set workspace payments

Confirm what was stored, including the resolved identifiers:

xratu config view --show-ids

Doing this before tenancy exists is not useful, since there is nothing to resolve. See Create your first organization and workspace.

When it fails

Commands report a connection refused against localhost:8080. The active profile has no endpoint, so the CLI fell back to its default. Re-run the profile set with --use, then check xratu config view.

You set XRATU_CP_ENDPOINT but commands ignore it. That variable seeds a config document only when one is first created. Once the file exists, the active profile decides. Set the endpoint on the profile.

Commands reach a different control plane than you expect. Another profile is active. Check current_profile in xratu config view and switch with xratu config profile use <name>.

xratu auth whoami returns an authorisation error rather than an actor. The profile carries a stale or invalid token. Clear it as in step 3.

You cannot find the config file. It is at ~/.xratu/config.json unless XRATU_CLI_CONFIG names another path.

What changed

The CLI now has an active profile pointing at your control plane, stored in ~/.xratu/config.json. Nothing on the control plane changed, and you still have no identity beyond the system actor.

The next step is exchanging an external identity for an Xratu token, which Self-hosted deployment carries in phase 2.