File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed
Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const Env = z.object({
1515 OTEL_EXPORTER_OTLP_ENDPOINT : z . string ( ) . url ( ) , // set on the runners
1616
1717 // Workload API settings (coordinator mode) - the workload API is what the run controller connects to
18- TRIGGER_WORKLOAD_API_ENABLED : BoolEnv . default ( " true" ) ,
18+ TRIGGER_WORKLOAD_API_ENABLED : BoolEnv . default ( true ) ,
1919 TRIGGER_WORKLOAD_API_PROTOCOL : z
2020 . string ( )
2121 . transform ( ( s ) => z . enum ( [ "http" , "https" ] ) . parse ( s . toLowerCase ( ) ) )
@@ -32,7 +32,7 @@ const Env = z.object({
3232 RUNNER_PRETTY_LOGS : BoolEnv . default ( false ) ,
3333
3434 // Dequeue settings (provider mode)
35- TRIGGER_DEQUEUE_ENABLED : BoolEnv . default ( " true" ) ,
35+ TRIGGER_DEQUEUE_ENABLED : BoolEnv . default ( true ) ,
3636 TRIGGER_DEQUEUE_INTERVAL_MS : z . coerce . number ( ) . int ( ) . default ( 250 ) ,
3737 TRIGGER_DEQUEUE_IDLE_INTERVAL_MS : z . coerce . number ( ) . int ( ) . default ( 1000 ) ,
3838 TRIGGER_DEQUEUE_MAX_RUN_COUNT : z . coerce . number ( ) . int ( ) . default ( 10 ) ,
Original file line number Diff line number Diff line change @@ -3,14 +3,19 @@ import { SimpleStructuredLogger } from "@trigger.dev/core/v3/utils/structuredLog
33
44const logger = new SimpleStructuredLogger ( "env-util" ) ;
55
6- export const BoolEnv = z . preprocess ( ( val ) => {
6+ const baseBoolEnv = z . preprocess ( ( val ) => {
77 if ( typeof val !== "string" ) {
88 return val ;
99 }
1010
1111 return [ "true" , "1" ] . includes ( val . toLowerCase ( ) . trim ( ) ) ;
1212} , z . boolean ( ) ) ;
1313
14+ // Create a type-safe version that only accepts boolean defaults
15+ export const BoolEnv = baseBoolEnv as Omit < typeof baseBoolEnv , "default" > & {
16+ default : ( value : boolean ) => z . ZodDefault < typeof baseBoolEnv > ;
17+ } ;
18+
1419export const AdditionalEnvVars = z . preprocess ( ( val ) => {
1520 if ( typeof val !== "string" ) {
1621 return val ;
Original file line number Diff line number Diff line change @@ -761,7 +761,7 @@ const EnvironmentSchema = z.object({
761761 . int ( )
762762 . default ( 60_000 * 5 ) , // 5 minutes
763763
764- BATCH_TRIGGER_CACHED_RUNS_CHECK_ENABLED : BoolEnv . default ( " false" ) ,
764+ BATCH_TRIGGER_CACHED_RUNS_CHECK_ENABLED : BoolEnv . default ( false ) ,
765765
766766 BATCH_TRIGGER_WORKER_ENABLED : z . string ( ) . default ( process . env . WORKER_ENABLED ?? "true" ) ,
767767 BATCH_TRIGGER_WORKER_CONCURRENCY_WORKERS : z . coerce . number ( ) . int ( ) . default ( 2 ) ,
Original file line number Diff line number Diff line change 11import { z } from "zod" ;
22
3- export const BoolEnv = z . preprocess ( ( val ) => {
3+ const baseBoolEnv = z . preprocess ( ( val ) => {
44 if ( typeof val !== "string" ) {
55 return val ;
66 }
77
88 return [ "true" , "1" ] . includes ( val . toLowerCase ( ) . trim ( ) ) ;
99} , z . boolean ( ) ) ;
10+
11+ // Create a type-safe version that only accepts boolean defaults
12+ export const BoolEnv = baseBoolEnv as Omit < typeof baseBoolEnv , "default" > & {
13+ default : ( value : boolean ) => z . ZodDefault < typeof baseBoolEnv > ;
14+ } ;
You can’t perform that action at this time.
0 commit comments