From 26303f95e8845050406cbb73942644d680d99c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BC=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Sat, 23 Apr 2022 20:24:24 +0300 Subject: [PATCH] emailer --- package.json | 1 + src/mailer.ts | 18 ++++++++++++++++++ tsconfig.json | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/mailer.ts diff --git a/package.json b/package.json index 9e97d7b..c31ed2b 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "author": "", "license": "MIT", "dependencies": { + "@ijl/mailer": "^1.1.0", "@types/cookie-session": "^2.0.44", "axios": "^0.26.1", "cookie-session": "^2.0.0", diff --git a/src/mailer.ts b/src/mailer.ts new file mode 100644 index 0000000..24af100 --- /dev/null +++ b/src/mailer.ts @@ -0,0 +1,18 @@ +import { AdminNotificationRequest, addToQueue, configs, init } from '@ijl/mailer' +import pkg from '../package.json' + +init({ + userName: process.env.SMTP_MAIL_LOGIN, + password: process.env.SMTP_MAIL_PASSWORD, + adminMails: process.env.MAIL_TO_1, + smtpConfig: configs.yandex, + reserveService: 'gmail', + reserveLogin: process.env.MAIL_SERVICE_LOGIN, + reservePasswd: process.env.MAIL_SERVICE_PASS, + queTimer: process.env.RC_MAIL_STEP_TIMER, +}) + +if (process.env.MAIL_TO_1 && process.env.MODE !== 'dev') { + addToQueue(new AdminNotificationRequest(`Деплой админки v${pkg.version} прошёл успешно`)) +} + \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index f351095..9df5f5a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,7 +25,7 @@ /* Modules */ "module": "commonjs", /* Specify what module code is generated. */ - "rootDir": "./src", /* Specify the root folder within your source files. */ + "rootDir": ".", /* Specify the root folder within your source files. */ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */