Multiple targets
Sync the same schema to multiple deployment targets
Use this pattern when the same schema needs to sync to more than one deployment
target, such as multiple Vercel projects or multiple GitHub environments. The
routing variable can represent anything: a territory, a brand, a client, or any
other axis that maps to a separate deployment. This example uses an
OE_ENV_TERRITORY variable with two values. The OE_ENV_ prefix keeps the
routing variable out of synced deployment variables.
Configure 1Password
Create one item per combination of environment and territory:
APP_ENV | OE_ENV_TERRITORY | 1Password item |
|---|---|---|
development | oegb | Project development oegb |
preview | oegb | Project preview oegb |
production | oegb | Project production oegb |
development | oefr | Project development oefr |
preview | oefr | Project preview oefr |
production | oefr | Project production oefr |
Write the schema
# @type=enum(oegb, oefr)
OE_ENV_TERRITORY=oegb
OE_ENV_VERCEL_PROJECT=project-${OE_ENV_TERRITORY}
OE_ENV_GITHUB_ENVIRONMENT=project-${OE_ENV_TERRITORY}
SECRET=op("op://Vault/Project ${APP_ENV} ${OE_ENV_TERRITORY}/SECRET")OE_ENV_TERRITORY selects the Vercel project, the GitHub environment, and the
1Password item, but is not synced to Vercel or GitHub.
Sync to your targets
Sync each territory to its own Vercel project and GitHub environment:
pnpm oe.env sync --vercel --github # uses default OE_ENV_TERRITORY=oegb
OE_ENV_TERRITORY=oefr pnpm oe.env sync --vercel --github # override for OEFROE_ENV_VERCEL_PROJECT and OE_ENV_GITHUB_ENVIRONMENT resolve per territory,
so each command targets a different Vercel project and GitHub environment. The
same schema syncs equivalent variables to all deployment targets.
Without target flags, oe.env sync also syncs to any configured default services. Running
OE_ENV_TERRITORY=oefr pnpm oe.env sync without target flags could push the OEFR secrets to
Vercel, GitHub, and CircleCI. Pass explicit targets, such as --vercel --github, to limit the
sync.