diff --git a/.env.example b/.env.example index c3fd1f3..4dc7854 100644 --- a/.env.example +++ b/.env.example @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/README.md b/README.md index 17ee5d8..a4f7665 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,9 @@ services: - MAIL_SECURE= # default ist auf false gesetzt - CLUB_NAME= # default ist auf FF Admin gesetzt - CLUB_WEBSITE= + - BACKUP_INTERVAL= # alle x Tage, sonst keine + - BACKUP_COPIES= # Anzahl parallel bestehender Backups + - BACKUP_AUTO_RESTORE= # default ist auf false gesetzt volumes: - :/app/files networks: diff --git a/src/env.defaults.ts b/src/env.defaults.ts index d4e3c3b..343a9b5 100644 --- a/src/env.defaults.ts +++ b/src/env.defaults.ts @@ -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) {