Sync env vars
Use the syncEnvVars build extension to automatically sync environment variables to Trigger.dev
The syncEnvVars
build extension will sync env vars from another service into Trigger.dev before the deployment starts. This is useful if you are using a secret store service like Infisical or AWS Secrets Manager to store your secrets.
syncEnvVars
takes an async callback function, and any env vars returned from the callback will be synced to Trigger.dev.
The callback is passed a context object with the following properties:
environment
: The environment name that the task is being deployed to (e.g.production
,staging
, etc.)projectRef
: The project ref of the Trigger.dev projectenv
: The environment variables that are currently set in the Trigger.dev project
Example: Sync env vars from Infisical
In this example we’re using env vars from Infisical.
syncVercelEnvVars
The syncVercelEnvVars
build extension syncs environment variables from your Vercel project to Trigger.dev.
You need to set the VERCEL_ACCESS_TOKEN
and VERCEL_PROJECT_ID
environment variables, or pass
in the token and project ID as arguments to the syncVercelEnvVars
build extension. If you’re
working with a team project, you’ll also need to set VERCEL_TEAM_ID
, which can be found in your
team settings. You can find / generate the VERCEL_ACCESS_TOKEN
in your Vercel
dashboard. Make sure the scope of the token covers
the project with the environment variables you want to sync.
Or you can pass in the token and project ID as arguments: