Skip to content

Commit a7b5a82

Browse files
authored
renamed variables
1 parent 00bb90f commit a7b5a82

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

config/envVarCheck.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { env } from "../src/typeDefinitions/default.types";
22
import { 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
*/
119
export 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();

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)