Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/runtime-secrets/src/trigger-env.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import { describe, expect, it } from 'vitest'
import { parseTriggerEnvSyncTargets } from './trigger-env'
import { buildTriggerEnvVars, parseTriggerEnvSyncTargets } from './trigger-env'

describe('buildTriggerEnvVars', () => {
it('leaves the worker-specific network endpoints to the Trigger.dev environment', () => {
const synced = buildTriggerEnvVars({
REDIS_URL: 'rediss://vpc-redis:6379',
INTERNAL_API_BASE_URL: 'http://app.internal',
OUTBOUND_GATEWAYS: '{"gw":{"url":"https://vpc-lb:8443"}}',
OUTBOUND_GATEWAY_CREDENTIALS: '{"gw":{"token":"t"}}',
OUTBOUND_ROUTING_SOURCE: 'appconfig',
}).map((v) => v.name)
expect(synced).not.toContain('REDIS_URL')
expect(synced).not.toContain('INTERNAL_API_BASE_URL')
expect(synced).not.toContain('OUTBOUND_GATEWAYS')
expect(synced).toContain('OUTBOUND_GATEWAY_CREDENTIALS')
expect(synced).toContain('OUTBOUND_ROUTING_SOURCE')
})
})

describe('parseTriggerEnvSyncTargets', () => {
it('reads an exact comma list', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/runtime-secrets/src/trigger-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const TRIGGER_OWNED_KEYS: ReadonlySet<string> = new Set([
'REDIS_TLS_SERVERNAME',
// A VPC-internal base URL is unreachable from Trigger.dev's cloud.
'INTERNAL_API_BASE_URL',
// The app dials an egress gateway through the VPC load balancer; workers dial it through their
// own endpoint, so each gateway's `url` differs. The credentials and routing source are shared.
'OUTBOUND_GATEWAYS',
// Schema-migration credential: runs never migrate, so they never hold it.
'MIGRATION_DATABASE_URL',
// `syncEnvVars` refuses to sync it, so it can only ever be set by hand.
Expand Down
Loading