Use case
I'm building an orchestrator that programmatically spawns Brev instances. Each spawned instance needs to come up with a small set of bootstrapping environment variables set (a callback URL and a one-time short-lived token, used by the instance's startup script to fetch the rest of its configuration from my orchestrator).
Today, brev create accepts --startup-script / -s but has no way to pass environment variables to that script. The workarounds I'm considering all have downsides:
- Bake the env vars into the startup-script string itself. Works, but means I'm constructing shell that interpolates secrets, which is awkward to do safely (quoting, escaping). It also leaks the values into the script text that's stored on the Brev side.
- Have the script fetch its bootstrapping config from a known endpoint by instance ID. Possible, but my orchestrator doesn't know the instance's identity until after
brev create returns, so the endpoint can't gate by instance — and gating by source IP requires a round-trip after creation completes.
- Use cloud-init
user-data. Brev doesn't surface that.
Proposal
Add a --env KEY=VALUE flag (repeatable) and a --env-file <path> flag to brev create, mirroring the convention from docker run, gcloud compute instances create --metadata, and aws ec2 run-instances --user-data. The values would be available as environment variables when the startup script runs.
brev create my-instance \
-s @setup.sh \
--env CALLBACK_URL=https://orchestrator.example.com \
--env BOOTSTRAP_TOKEN=xxxxxxxx
Or:
brev create my-instance -s @setup.sh --env-file ./bootstrap.env
This is a common pattern in every other cloud CLI I've used and would unblock a clean separation between "Brev knows how to start a VM and run a script" and "my orchestrator's own bootstrap flow."
Happy to send a PR if there's interest and a hint about where this would slot in.
Use case
I'm building an orchestrator that programmatically spawns Brev instances. Each spawned instance needs to come up with a small set of bootstrapping environment variables set (a callback URL and a one-time short-lived token, used by the instance's startup script to fetch the rest of its configuration from my orchestrator).
Today,
brev createaccepts--startup-script/-sbut has no way to pass environment variables to that script. The workarounds I'm considering all have downsides:brev createreturns, so the endpoint can't gate by instance — and gating by source IP requires a round-trip after creation completes.user-data. Brev doesn't surface that.Proposal
Add a
--env KEY=VALUEflag (repeatable) and a--env-file <path>flag tobrev create, mirroring the convention fromdocker run,gcloud compute instances create --metadata, andaws ec2 run-instances --user-data. The values would be available as environment variables when the startup script runs.Or:
This is a common pattern in every other cloud CLI I've used and would unblock a clean separation between "Brev knows how to start a VM and run a script" and "my orchestrator's own bootstrap flow."
Happy to send a PR if there's interest and a hint about where this would slot in.