Setting the file. One moment.
Subchapter 5.1
references/environment-setup.mdMarkdown2 KBView on GitHub
| Variable | Description | Where to find |
|---|---|---|
TRIGGER_SECRET_KEY | API key for authentication | Dashboard > API Keys |
# Development (starts with tr_dev_)
TRIGGER_SECRET_KEY=tr_dev_xxxxx
# .env
TRIGGER_SECRET_KEY=tr_dev_xxxxxAdd to .gitignore:
.env
.env.localexport TRIGGER_SECRET_KEY=tr_dev_xxxxx
npx trigger dev- name: Deploy Trigger.dev
env:
TRIGGER_SECRET_KEY: ${{ secrets.TRIGGER_SECRET_KEY }}
run: npx trigger deployAdd TRIGGER_SECRET_KEY in Project Settings > Environment Variables.
Set TRIGGER_SECRET_KEY in your platform’s secret management.
Use different keys per environment:
| Environment | Key Prefix | Dashboard Section |
|---|---|---|
| Development | tr_dev_ | Dev environment |
| Staging | tr_stg_ | Staging environment |
| Production | tr_prod_ | Prod environment |
Tasks run in Trigger.dev’s infrastructure. To use env vars in tasks:
syncEnvVars extension):// trigger.config.ts
import { defineConfig } from "@trigger.dev/sdk";
import { syncEnvVars } from "@trigger.dev/build/extensions/core";
export default defineConfig({
project: "proj_xxxxx",
build: {
extensions: [
syncEnvVars(),
],
},
});Set in dashboard: Project Settings > Environment Variables
Access in tasks:
export const myTask = task({
id: "my-task",
run: async () => {
const apiKey = process.env.EXTERNAL_API_KEY;
// ...
},
});