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

@ -16,7 +16,11 @@ MAIL_USERNAME = mail_username
MAIL_PASSWORD = mail_password
MAIL_HOST = mail_hoststring
MAIL_PORT = mail_portnumber
MAIL_SECURE (true|false) // true for port 465, fals for other ports
MAIL_SECURE = (true|false) // true for port 465, fals for other ports
CLUB_NAME = clubname #default FF Admin
CLUB_WEBSITE = https://my-club-website-url
CLUB_WEBSITE = https://my-club-website-url
BACKUP_INTERVAL = number of days (min 1)
BACKUP_COPIES = number of parallel copies
BACKUP_AUTO_RESTORE = (true|false) # default false

View file

@ -42,6 +42,9 @@ services:
- MAIL_SECURE=<boolean> # default ist auf false gesetzt
- CLUB_NAME=<tobemodified> # default ist auf FF Admin gesetzt
- CLUB_WEBSITE=<tobemodified>
- BACKUP_INTERVAL=<number of days (min. 1)> # alle x Tage, sonst keine
- BACKUP_COPIES=<number of parallel copies> # Anzahl parallel bestehender Backups
- BACKUP_AUTO_RESTORE=<boolean> # default ist auf false gesetzt
volumes:
- <volume|local path>:/app/files
networks:

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) {