@@ -2,7 +2,7 @@ import consola from "consola";
|
||||
import "reflect-metadata";
|
||||
import { createExpressServer } from "routing-controllers";
|
||||
import authchecker from "./authchecker";
|
||||
import { config } from './config';
|
||||
import { config, e as errors } from './config';
|
||||
import loaders from "./loaders/index";
|
||||
import { ErrorHandler } from './middlewares/ErrorHandler';
|
||||
|
||||
@@ -23,4 +23,9 @@ async function main() {
|
||||
);
|
||||
});
|
||||
}
|
||||
main();
|
||||
if (errors === 0) {
|
||||
main();
|
||||
} else {
|
||||
console.log("error");
|
||||
// something's wrong
|
||||
}
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
import * as dotenvSafe from "dotenv-safe";
|
||||
dotenvSafe.config();
|
||||
import { config as configDotenv } from 'dotenv';
|
||||
configDotenv();
|
||||
export const config = {
|
||||
internal_port: process.env.APP_PORT || 4010,
|
||||
internal_port: parseInt(process.env.APP_PORT) || 4010,
|
||||
development: process.env.NODE_ENV === "production",
|
||||
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
|
||||
phone_validation_countrycode: process.env.PHONE_COUNTRYCODE || "ZZ"
|
||||
}
|
||||
}
|
||||
let errors = 0
|
||||
if (typeof config.internal_port !== "number") {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.phone_validation_countrycode !== "string") {
|
||||
errors++
|
||||
}
|
||||
if (config.phone_validation_countrycode.length !== 2) {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.development !== "boolean") {
|
||||
errors++
|
||||
}
|
||||
export let e = errors
|
||||
Reference in New Issue
Block a user