remove secrets and replace it with env barrel

This commit is contained in:
zkldi
2021-05-25 20:28:07 +01:00
parent ad3790707f
commit cfa0b92e2d
3 changed files with 27 additions and 13 deletions
+2 -2
View File
@@ -3,8 +3,6 @@ js
# .vscode
logs
src/secrets.ts
.nyc_output
coverage
.env
@@ -15,3 +13,5 @@ scripts/arc-db-sync/songs.json
scripts/validate-database-errs/*
scripts/__JSON-TO-KTDB/**/*.json
/src/lib/env/config.json
-11
View File
@@ -1,11 +0,0 @@
// This is an example file for the secrets.ts file - which is not not available in the repository.
export const CAPTCHA_SECRET_KEY = "change-me";
export const SESSION_SECRET = "change-me";
export const FLO_API_URL = "https://google.com";
export const EAG_API_URL = "https://google.com";
export const ARC_API_URL = "https://google.com";
+25
View File
@@ -0,0 +1,25 @@
// barrel file for re-exporting env variables.
const envVars = [
"KTBKS_MONGO_BASE_URL",
"KTBKS_LOG_LEVEL",
"KTBKS_CAPTCHA_SECRET_KEY",
"KTBKS_SESSION_SECRET",
"KTBKS_FLO_API_URL",
"KTBKS_EAG_API_URL",
"KTBKS_ARC_API_URL",
];
for (const eVar of envVars) {
if (!process.env[eVar]) {
throw new Error(`${eVar} was not defined.`);
}
}
export const MONGO_BASE_URL = process.env.KTBKS_MONGO_BASE_URL!;
export const LOG_LEVEL = process.env.KTBKS_LOG_LEVEL!;
export const SESSION_SECRET = process.env.KTBKS_SESSION_SECRET!;
export const CAPTCHA_SECRET_KEY = process.env.KTBKS_CAPTCHA_SECRET_KEY!;
export const FLO_API_URL = process.env.KTBKS_FLO_API_URL!;
export const EAG_API_URL = process.env.KTBKS_EAG_API_URL!;
export const ARC_API_URL = process.env.KTBKS_ARC_API_URL!;