A CLI tool to manage context profiles for OpenBao. This allows you to save connection and configuration details, which would otherwise be set using environment variables — into named context profiles, and easily switch between them.
- Download the latest release from the Releases page.
- Install the package for your distribution:
- Debian/Ubuntu:
sudo apt install baoctx-<version>.deb - Fedora/RHEL:
sudo dnf install baoctx-<version>.rpm - Arch Linux (AUR):
yay -S baoctx-bin.
- Debian/Ubuntu:
There are two OpenBao clusters, one for Dev (http://dev-openbao:8200) and one for Prod (https://prod-openbao:8200).
Running bao CLI commands locally will by default attempt to connect to https://localhost:8200. To connect to another cluster, you need to set the appropriate BAO_* environment variables. baoctx lets you save multiple sets of connection details into context profiles and switch between them easily.
A context profile is a named set of configuration parameters for an OpenBao instance. For example, a prod context profile might have an endpoint of https://prod-openbao:8200, a namespace of admin/prod, and a token. Selecting that profile renders the corresponding export BAO_ADDR=...; export BAO_NAMESPACE=...; export BAO_TOKEN=... commands, which can be applied to the current shell with eval.
eval $(baoctx select prod)- OpenBao
baoctx can set default context profiles that are automatically loaded into new shell sessions via environment variables. To enable this, configure your shell's startup script with:
baoctx config --path "~/.zshrc"baoctx config --path "~/.config/fish/config.fish" --shell fishThis appends a small helper script that sources all defaults when a new shell session starts.
baoctx create staging \
--endpoint "https://staging-openbao.example.com:8200" \
--cacert "/path/to/ca.pem" \
--cert "/path/to/client.pem" \
--key "/path/to/client-key.pem" \
--skip-verify true \
--cli-no-colour true \
--client-timeout "60s" \
--format "json"baoctx create testing \
--endpoint https://testing-openbao.example.com:8200 \
--auth-method oidc \
--oidc-callback-host localhost \
--oidc-listen-addr 127.0.0.1 \
--oidc-role device \
--oidc-callback-mode devicebaoctx update staging \
--endpoint "https://staging-openbao.example.com:8200" \
--cacert "/path/to/new-ca.pem" \
--skip-verify true \
--format "json"baoctx delete stagingbaoctx listSet a default context profile with the set-default sub command:
baoctx set-default stagingOnce a default has been set, new shell sessions will spawn with those environment variables already exported.
Switch context using the select sub command:
baoctx select devThis prints all export BAO_* commands for the selected context profile. To apply them in the current shell:
eval $(baoctx select dev)