File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11import { env } from "../src/typeDefinitions/default.types" ;
22import { loadEnv } from "./config" ;
33
4- validateEnv ( ) ;
5-
64/**
75 * Validate if all the required environment variables are set to a non empty value
86 * else throw an error
97 * ---
108 */
119export function validateEnv ( ) {
1210 //pass empty object as env and fromWorkerEnv = false, since this method is should get executed in github actions and not in worker
13- const envLoadedFromProcess : env = loadEnv ( { } , false ) ;
14- const missingEnvVars = Object . keys ( envLoadedFromProcess ) . filter (
15- ( key ) => envLoadedFromProcess [ key ] == ""
11+ const env : env = loadEnv ( { } , false ) ;
12+ const missingEnvVariables = Object . keys ( env ) . filter (
13+ ( key ) => env [ key ] == ""
1614 ) ;
1715
1816 // Logging missing environment variables and throw error if any are missing
19- if ( missingEnvVars . length > 0 ) {
17+ if ( missingEnvVariables . length > 0 ) {
2018 throw new Error (
21- `Missing environment variables: ${ missingEnvVars . join ( ", " ) } `
19+ `Missing environment variables: ${ missingEnvVariables . join ( ", " ) } `
2220 ) ;
2321 } else {
2422 console . log ( "All required environment variables are set." ) ;
2523 }
2624}
25+
26+ validateEnv ( ) ;
Original file line number Diff line number Diff line change @@ -107,12 +107,12 @@ export default {
107107 return new JSONResponse ( response . BAD_SIGNATURE , { status : 401 } ) ;
108108 }
109109 }
110- const env : env = loadEnv ( env , true ) ;
111- return router . handle ( request , env , ctx ) ;
110+ const Env : env = loadEnv ( env , true ) ;
111+ return router . handle ( request , Env , ctx ) ;
112112 } ,
113113
114114 async scheduled ( req : Request , env : env , ctx : ExecutionContext ) {
115- const env : env = loadEnv ( env , true ) ;
116- ctx . waitUntil ( send ( env ) ) ;
115+ const Env : env = loadEnv ( env , true ) ;
116+ ctx . waitUntil ( send ( Env ) ) ;
117117 } ,
118118} ;
You can’t perform that action at this time.
0 commit comments