Skip to content

surreal cloud

/

Commands

surreal cloud context

surreal cloud context inspects and switches profiles. A profile bundles a credential, an API base URL and a set of configuration values, so switching profile changes all three in one move.

Usage
surreal cloud context <COMMAND> [OPTIONS]surreal cloud contexts <COMMAND> [OPTIONS]
VerbPurposeAlias
showShow the context this invocation resolved
useSwitch to a different profile
listList the configured profilesls

context use switches profile. org use remembers an organisation within a profile. Neither is expressible as the other, and you will usually want both: one profile per account or tenant, one remembered organisation inside each.

Show the context this invocation resolved.

Usage
surreal cloud context show [OPTIONS]

This command takes no positional arguments and no options of its own.

surreal cloud context show
Output
Profile         work
Organization    acme
Id              67upif0m8sh1cn1p2c8t
Source          persisted context (`org use`)
API             https://api.surrealdb.com
Config          /Users/ana/.surrealdb/cloud/config.toml
Store           /Users/ana/.surrealdb/cloud/credentials.json

The command resolves through the same chain every other command uses, including the interactive picker when several organisations are available and nothing has chosen - so what it reports is exactly what the next command will do.

A failure to resolve an organisation is reported as part of the answer rather than as an error: the profile, the API base and both file paths are still printed, followed by a note and the hint surreal cloud org use <name>.

Which organisation would this command hit?
surreal cloud context show --json | jq -r '.organization.name + " via " + .source'

Switch to a different profile.

Usage
surreal cloud context use [OPTIONS] <PROFILE>

Arguments

NameDescription
<PROFILE>
required
The profile to make active.

This command has no options of its own.

Switch
surreal cloud context use staging
Create a profile and sign into it
surreal cloud context use staging
surreal cloud auth login

The profile is created if it does not exist. A new profile gets a note that it has no stored credentials, plus the hint naming the login command for it.

Refusals. An empty or whitespace-only name is a usage error, exit 2:

Ensure the profile name is not empty.

Warnings. The command warns when SURREAL_CLOUD_PROFILE is set, because the variable outranks the file it just wrote.

For a single command against a different profile, pass --profile rather than switching:

surreal cloud --profile staging instance list

List the configured profiles.

Usage
surreal cloud context list [OPTIONS]

This command takes no positional arguments and no options of its own.

Accepts the list presentation flags. Column ids are profile, active, org and api, with source under --wide.

surreal cloud context list
Output
PROFILE   ACTIVE  ORGANIZATION  API
default   no      contoso       https://api.surrealdb.com
work      yes     acme          https://api.surrealdb.com
See where each organisation came from
surreal cloud context list --wide

The profile in force is always listed, even when the file has no entry for it - so --profile scratch context list shows scratch. The order is stable between runs.

Was this page helpful?