dynamic db type

This commit is contained in:
Julian Krauser 2024-08-26 17:00:23 +02:00
parent 2f5d9d3f01
commit c7e48c0334
3 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import "dotenv/config";
import ms from "ms";
export const DB_TYPE = process.env.DB_TYPE ?? "mysql";
export const DB_HOST = process.env.DB_HOST ?? "";
export const DB_NAME = process.env.DB_NAME ?? "";
export const DB_USERNAME = process.env.DB_USERNAME ?? "";
@ -21,6 +22,7 @@ export const MAIL_SECURE = process.env.MAIL_SECURE ?? "false";
export const CLUB_NAME = process.env.CLUB_NAME ?? "";
export function configCheck() {
if (DB_TYPE == "" ?? typeof DB_TYPE != "string") throw new Error("set valid value to DB_TYPE");
if (DB_HOST == "" ?? typeof DB_HOST != "string") throw new Error("set valid value to DB_HOST");
if (DB_NAME == "" ?? typeof DB_NAME != "string") throw new Error("set valid value to DB_NAME");
if (DB_USERNAME == "" ?? typeof DB_USERNAME != "string") throw new Error("set valid value to DB_USERNAME");