stackblaze variables
App environment variables
Usage: stackblaze variables|vars [options] [command]
App environment variables
Options:
-h, --help Print help
Commands:
list [options] List environment variables (values masked
unless --reveal)
set [options] [pairs...] Set one or more KEY=value pairs in one
release
unset|delete [options] <keys...> Remove environment variables by name in one
release
import [options] <file> Set every variable from a .env file in one
release
edit [options] Edit variables in $EDITOR, review the diff,
apply in one release
help [command] Print this message or the help of the given
subcommand(s)
Every write is ONE release made by the server (git apps rebuild, others
roll). Add --skip-deploy to stage instead, then `stackblaze pending apply`.
Examples:
$ stackblaze variables list --reveal
$ stackblaze variables set LOG_LEVEL=debug FEATURE_X=on -m "Debug FEATURE_X"
$ printf %s "$TOKEN" | stackblaze variables set API_TOKEN --stdin
$ stackblaze variables unset OLD_FLAG -y
$ stackblaze variables import .env.production --replace
$ stackblaze variables editvariables list
Usage: stackblaze variables list [options]
List environment variables (values masked unless --reveal)
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--reveal Show values (requires write access to the app)
(default: false)
--all Include platform-injected variables (hidden by
default) (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
List an app's variables. Values are masked unless you pass --reveal (needs write access to the app).
stackblaze variables list -p github-demo-cw8z -e dev -a hello-web
stackblaze variables list -p github-demo-cw8z -e dev -a hello-web --revealOK github-demo-cw8z/dev/hello-web-qw6y
GREETING=••••••••
PORT=••••••••
Values are masked; pass --reveal to show them (needs write access).
OK github-demo-cw8z/dev/hello-web-qw6y
GREETING=hello
PORT=8080
LOG_LEVEL=debug
FEATURE_SEARCH=onThe second listing is after the variables set example. Add --all to include the variables the platform injects.
variables set
Usage: stackblaze variables set [options] [pairs...]
Set one or more KEY=value pairs in one release
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--skip-deploy Stage the change on the server instead of deploying it
(apply later with `pending apply`) (default: false)
-m, --message <text> Release message shown in the deployments timeline
--stdin Read KEY=VALUE lines from stdin, or the value of a
single bare KEY (keeps secrets out of shell history)
(default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print help
Examples:
$ stackblaze variables set NODE_ENV=production PORT=8080
$ printf %s "$SECRET" | stackblaze variables set STRIPE_KEY --stdin
$ stackblaze variables set STRIPE_KEY --stdin (prompts, input hidden)
$ cat .env | stackblaze variables set --stdin
$ stackblaze variables set FOO=1 --skip-deploy (stage, apply later)Example
Set two variables in one release, with a message for the deployments timeline.
stackblaze variables set LOG_LEVEL=debug FEATURE_SEARCH=on -p github-demo-cw8z -e dev -a hello-web -m "Turn on search"OK Updated github-demo-cw8z/dev/hello-web-qw6y: LOG_LEVEL, FEATURE_SEARCH
One release: rolling out (config revision cmww804df0033wn01o5acjwh4). Follow it with `stackblaze deployments`.To keep a secret out of your shell history, pipe it in: printf %s "$SECRET" | stackblaze variables set API_KEY --stdin.
variables unset
Usage: stackblaze variables unset|delete [options] <keys...>
Remove environment variables by name in one release
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--skip-deploy Stage the change on the server instead of deploying it
(apply later with `pending apply`) (default: false)
-m, --message <text> Release message shown in the deployments timeline
-y, --yes Skip confirmation prompt (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
Remove a variable. Type yes to confirm, or pass -y.
stackblaze variables unset FEATURE_SEARCH -p github-demo-cw8z -e dev -a hello-web! This will DELETE 1 variable(s) from github-demo-cw8z/dev/hello-web-qw6y: FEATURE_SEARCH
Type "yes" to continue: yes
OK Updated github-demo-cw8z/dev/hello-web-qw6y: FEATURE_SEARCH
One release: rolling out (config revision cmww80vvi0036wn019c60smi2). Follow it with `stackblaze deployments`.variables import
Usage: stackblaze variables import [options] <file>
Set every variable from a .env file in one release
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--skip-deploy Stage the change on the server instead of deploying it
(apply later with `pending apply`) (default: false)
-m, --message <text> Release message shown in the deployments timeline
--replace Make the app's own variables exactly the file (others
are removed; add-on/env-group vars are kept) (default:
false)
-y, --yes Skip the --replace removal confirmation (default:
false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print helpExample
Set every variable from a .env file in one release. Variables that aren't in the file stay as they are (pass --replace to remove them).
cat .env.production
stackblaze variables import .env.production -p github-demo-cw8z -e dev -a hello-web -m "Import production settings"CACHE_TTL=300
SUPPORT_EMAIL=help@example.com
OK Imported into github-demo-cw8z/dev/hello-web-qw6y: CACHE_TTL, SUPPORT_EMAIL
One release: rolling out (config revision cmww82bif005puz01d5nsbwb5). Follow it with `stackblaze deployments`.variables edit
Usage: stackblaze variables edit [options]
Edit variables in $EDITOR, review the diff, apply in one release
Options:
--api-url <url> StackBlaze API base URL (env STACKBLAZE_API_URL)
--token <token> API token, sb_pat_... (env STACKBLAZE_TOKEN)
-p, --project <name> Project name
-e, --env <name> Environment name (default: production)
-a, --app <name> App name
--json Output JSON (same as -o json) (default: false)
--skip-deploy Stage the change on the server instead of deploying it
(apply later with `pending apply`) (default: false)
-m, --message <text> Release message shown in the deployments timeline
-y, --yes Apply without the confirmation prompt (default: false)
-o, --output <format> Output format: text or json (choices: "text", "json")
-h, --help Print help
Opens $VISUAL / $EDITOR (default vi) on a KEY=VALUE buffer of the app's own
variables (needs write access). After you save and quit, the added (+),
changed (~) and removed (-) names are shown and you confirm before ONE
PATCH is sent. The temporary file is created 0600 and deleted afterwards.Example
Edit the app's variables in your editor. Here the editor changed LOG_LEVEL, deleted CACHE_TTL and added MAINTENANCE; after you save and quit, the CLI lists the changes and asks before it ships them as one release.
stackblaze variables edit -p github-demo-cw8z -e dev -a hello-web+ MAINTENANCE
~ LOG_LEVEL
- CACHE_TTL
Apply 3 change(s) to github-demo-cw8z/dev/hello-web-qw6y? Type "yes": yes
OK Updated github-demo-cw8z/dev/hello-web-qw6y: CACHE_TTL, MAINTENANCE, LOG_LEVEL
One release: rolling out (config revision cmww83ymj0065uz01q547qmmd). Follow it with `stackblaze deployments`.