Manage API environments from the terminal
Environments are usually edited in the app. Sometimes a terminal is better: setting up an environment for a new preview deployment from a script, rotating a token from a password manager without copying it through a clipboard, or checking which variables an environment has from a CI job.
List and read
requestarium env
requestarium env show Staging
requestarium env show Staging --show-secretsenv prints each environment with its variable names; secret ones are marked with *. env show prints the values, masking secrets unless you add --show-secrets.
Change a value
requestarium env set Staging baseUrl https://staging.example.com
requestarium env unset Staging legacyFlagenv set keeps a secret variable secret when you change its value. To turn a secret into a plain value, add --no-secret.
Secrets from standard input
Typing a token on the command line puts it in your shell history and, on shared machines, in the process list. Read it from standard input instead:
op read "op://Engineering/Staging API/token" | requestarium env set Staging apiToken - --secret
pbpaste | requestarium env set Staging apiToken - --secretThe - means "read from stdin". The value is stored as a secret variable: encrypted on the server and masked in the app and in reports.
Create an environment
requestarium env create "Preview 482" --group "Orders" \
--var baseUrl=https://pr-482.preview.example.com \
--var tenant=preview \
--secret-var apiToken--secret-var creates the variable as a secret, without a value; fill it with env set … - afterwards. --default makes the new environment the workspace's default.
For previews, though, you often don't need a new environment per pull request: one Preview environment and --var baseUrl=… per run is simpler. See testing preview environments.
Point an environment at a secret manager
The CLI can fetch secrets from AWS Secrets Manager, Azure Key Vault or Google Cloud Secret Manager at run time, configured by variables on the environment:
requestarium env set Staging RQ_AWS_SECRET_NAME prod/orders-api
requestarium env set Staging RQ_AWS_REGION eu-central-1See AWS Secrets Manager in API tests.
Scripting with JSON
--json gives you data instead of a table, for scripts that check an environment before a run. Look at its shape once with requestarium env --json | jq . and pick the fields you need from there.
Workspaces and profiles
With several workspaces, pass --workspace NAME. With several accounts or servers, --profile NAME picks the saved login, as with every command. See CLI profiles for multiple accounts.
What the CLI doesn't do
Environment groups are created and renamed in the app; env create --group puts a new environment into a group. Values from a local .env file aren't environments at all: pass them to a run with --env-file.