From d1a8440b4e17fb6e0fd060980d8f2b44759c42ca Mon Sep 17 00:00:00 2001 From: Clara K Date: Tue, 17 Sep 2024 21:01:59 +0200 Subject: [PATCH] Delete application/config.js --- application/config.js | 49 ------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 application/config.js diff --git a/application/config.js b/application/config.js deleted file mode 100644 index a779b93..0000000 --- a/application/config.js +++ /dev/null @@ -1,49 +0,0 @@ -// Note: Also update app.json and README.md! - -const config = { - email: { - domains: process.env.DOMAINS, - deleteMailsOlderThanDays: process.env.DELETE_MAILS_OLDER_THAN_DAYS - }, - imap: { - user: process.env.IMAP_USER, - password: process.env.IMAP_PASSWORD, - host: process.env.IMAP_SERVER, - port: 993, - tls: true, - authTimeout: 3000, - refreshIntervalSeconds: process.env.IMAP_REFRESH_INTERVAL_SECONDS - }, - http: {port: normalizePort(process.env.PORT || '3000')}, - branding: process.env.BRANDING || ["PROJECT_NAME", "YOUR_NAME", "YOUR_WEBSITE"] -} - -if (!config.imap.user || !config.imap.password || !config.imap.host) { - throw new Error('IMAP is not configured. Use IMAP_* ENV vars.') -} - -if (!config.email.domains) { - throw new Error('DOMAINS is not configured. Use ENV vars.') -} - -/** - * Normalize a port into a number, string, or false. - */ - -function normalizePort(val) { - const port = parseInt(val, 10) - - if (isNaN(port)) { - // Named pipe - return val - } - - if (port >= 0) { - // Port number - return port - } - - return false -} - -module.exports = config