extend ENVs

This commit is contained in:
Julian Krauser 2025-01-25 16:54:01 +01:00
parent 46ad96c470
commit 684c24e4fd
3 changed files with 16 additions and 2 deletions

View file

@ -24,6 +24,10 @@ export const MAIL_SECURE = process.env.MAIL_SECURE ?? "false";
export const CLUB_NAME = process.env.CLUB_NAME ?? "FF Admin";
export const CLUB_WEBSITE = process.env.CLUB_WEBSITE ?? "";
export const BACKUP_INTERVAL = Number(process.env.CLUB_WEBSITE ?? "0");
export const BACKUP_COPIES = Number(process.env.CLUB_WEBSITE ?? "0");
export const BACKUP_AUTO_RESTORE = process.env.CLUB_WEBSITE ?? "false";
export function configCheck() {
if (DB_TYPE != "mysql" && DB_TYPE != "sqlite") throw new Error("set valid value to DB_TYPE (mysql|sqlite)");
if (DB_HOST == "" || typeof DB_HOST != "string") throw new Error("set valid value to DB_HOST");
@ -49,6 +53,9 @@ export function configCheck() {
!/^(http(s):\/\/.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/.test(CLUB_WEBSITE)
)
throw new Error("CLUB_WEBSITE is not valid url");
if (BACKUP_AUTO_RESTORE != "true" && BACKUP_AUTO_RESTORE != "false")
throw new Error("set 'true' or 'false' to BACKUP_AUTO_RESTORE");
}
function checkMS(input: string, origin: string) {