On this page
obi config
Manage saved contexts: switch between servers, workspaces, and sign-ins.
A context is a server, a sign-in, and a workspace, like a kubectl context's
cluster, user, and namespace. One obi login covers
every workspace you belong to, so a context per workspace needs only
set-context:
obi login
obi config set-context prod --workspace acme-prod
obi config set-context staging --workspace acme-staging
obi config use-context staging
obi get incidents -n acme-prod # another workspace for one command
obi config view [--show-token]
obi config get-contexts
obi config current-context
obi config use-context NAME
obi config set-context NAME [--server URL] [--user USER] [--workspace NAME] [--token TOKEN] [--current]
obi config set-context --current --workspace NAME
obi config rename-context OLD NEW
obi config delete-context NAME
obi config path
Setting up a context
set-context creates a context, or changes the one you name:
| Flag | Meaning |
|---|---|
--workspace NAME | The workspace the context acts in: a name, slug, or id. --workspace "" goes back to the one you signed in to. |
--server URL | The API to use. A new context starts on the current context's server. |
--user USER | Which sign-in to use, from obi config view. A new context starts with the current context's sign-in when it is on the same server. |
--token TOKEN | Save a personal access token as this context's sign-in. |
--current | Make it the current context. With no NAME, change the current context instead. |
obi checks the workspace when you set it, so a typo or a workspace you are
not in is reported straight away. A new context becomes current only when
there is none yet, or when you pass --current. To sign in to a context you
set up without a sign-in, run obi login while it is
current.
obi config set-context staging --server https://api.staging.example.com --token obi_...
obi --context staging get incidents # one command against another context
obi config view # tokens are hidden unless you add --show-token
Where contexts are kept
In ~/.config/obi/config.json, or under $XDG_CONFIG_HOME/obi, or at the path
in OBI_CONFIG. obi config path prints it. The file is readable only by you,
because it holds your tokens. A newly created or rotated API key is printed
once and never saved to it.
Which context a command uses, most specific first: --context, then
OBI_CONTEXT, then the current context. Which workspace: -n (or
--workspace), then OBI_WORKSPACE, then the context's. --server and
--token, or OBI_SERVER and OBI_TOKEN, override that context's server and
credential; a token given that way acts in its own workspace.