From 278c56386b0e9079a71d3339b40d08f046255a3e Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 30 Jan 2021 17:21:52 +0100 Subject: [PATCH] Added config class --- src/config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/config.ts diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..07df5a6 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,15 @@ +import { config as configDotenv } from 'dotenv'; + +configDotenv(); +export const config = { + internal_port: parseInt(process.env.APP_PORT) || 4010, + development: process.env.NODE_ENV === "production" +} +let errors = 0 +if (typeof config.internal_port !== "number") { + errors++ +} +if (typeof config.development !== "boolean") { + errors++ +} +export let e = errors \ No newline at end of file