bdy variable inject

View as Markdown
$bdy variable inject|exec [options] <command...>

Run a command with the variables of an environment injected into its process, without storing them on disk. Encrypted values need a personal access token with the MASKED_VARIABLE_VALUE_DECRYPTED scope, the manage permission on the environment and decrypted values allowed on it. Required scopes: VARIABLE_READ, ENVIRONMENT_READ, MASKED_VARIABLE_VALUE_DECRYPTED

ARGUMENTS
command
Command to run with its arguments, after -- (required)
OPTIONS
--context <name>
Connection and scope context: default, git, link or a saved name. Overrides the globally active context for this invocation.
--examples
Show only examples; with this flag --format accepts text, json or jsonl
--verbose
Show REST API requests, responses, timing and retries on stderr
-w, --workspace <domain>
Workspace URL handle. Can be set via variable: BUDDY_WORKSPACE
-p, --project <name>
Project name. Can be set via variable: BUDDY_PROJECT
--scope <scope>
Force scope (WORKSPACE, PROJECT). By default calculated by provided options and environmental variables (--project, BUDDY_PROJECT, linked project)
--environment <identifier>
Environment identifier (required). Its variables and those of its base environments are injected, its own winning. Looked up in the project first (--project, BUDDY_PROJECT or the linked project), then in the workspace; --scope picks exactly one of them
--var <key>
Inject only this VAR variable into the environment of the command; repeatable. By default every VAR variable of the environment is injected
--var-file <key:path>
Write a file variable (FILE, SSH_KEY, SSH_PUBLIC_KEY, GPG_KEY, P12, IOS_KEYCHAIN, IOS_PROVISION_PROFILES) to a new file at PATH for the time of the command, then delete it; repeatable. Its password and passphrase go into KEY_PASSWORD and KEY_PASSPHRASE
--no-masking
Do not mask encrypted values in the output of the command. The command then gets the terminal directly, which interactive programs need
--wait <seconds>
With masking: how many seconds to wait, after the command exited, for its output to close - a process it left in the background keeps it open. Past that bdy stops passing the output on and exits with 1 (such a process gets SIGPIPE on its next write). 0 waits without a limit. Time a slow reader of the output holds it up is not counted (default: 300)
-h, --help
display help for command

Documentation for bdy v1.26.3

Last modified on Nov 24, 2026

Examples

Run a command with every VAR variable of an environment
bdy var inject --environment staging -- npm run migrate$
Inject only the chosen variables
bdy var exec --environment staging --var DB_URL --var API_TOKEN -- ./deploy.sh$
Write an SSH key to a file for the time of the command
bdy var inject --environment staging --var-file DEPLOY_KEY:./deploy_key -- ssh -i ./deploy_key user@host$
Give an interactive program the terminal (no output masking)
bdy var run --environment staging --no-masking -- psql$
Use the workspace environment even inside a linked project
bdy var inject --environment staging --scope WORKSPACE -- npm run migrate$