Environment variables
The yofix env commands manage the environment variables a project uses at
build and run time. Variables are scoped to one or more targets (for
example preview and production), so a value can differ between
environments or be shared across them.
List variables
yofix env listValues are masked. To see only the keys (handy for scripting):
yofix env list --plainyofix env list --target productionSet a variable
yofix env set API_URL https://api.example.comBy default a new variable applies to both preview and production. Scope
it to specific targets with a repeatable --target:
yofix env set API_URL https://staging.example.com --target previewyofix env set STRIPE_KEY --target production --secretOmit the value to read it from stdin, which keeps secrets out of your shell history:
echo -n "$STRIPE_KEY" | yofix env set STRIPE_KEY --target production --secret--secret marks the variable write-only: it can be set and used in builds,
but never read back.
Read a single variable
yofix env get API_URLyofix env get STRIPE_KEY --reveal # fetch the plaintext value (audited)Revealing a value is logged server-side.
Delete a variable
yofix env unset OLD_FLAG # removes it across all targetsyofix env unset OLD_FLAG --yes # skip the confirmation promptPull values into a dotenv file
Write every variable (with values) to a local dotenv file for local development. Each value is revealed, so this action is audited:
yofix env pull # writes .env.localyofix env pull .env.production --target productionImport from a dotenv file
Bulk-load variables from an existing file:
yofix env import .env.production --target productionyofix env import .env --replace-existingWithout --replace-existing, keys that already exist are left untouched.
Clone between targets
Extend a variable’s targets so the same value also applies elsewhere, without re-entering it:
yofix env clone --from preview --to productionThis adds production to the targets of every variable currently scoped to
preview. The value stays shared; it is not copied.
Flags
| Command | Notable flags |
|---|---|
env list | --target <env>, --plain |
env get | --reveal |
env set | --target <env...>, --secret |
env unset | -y, --yes |
env pull | --target <env> |
env import | --target <env...>, --replace-existing |
env clone | --from <target>, --to <target> (both required) |