diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
commit | 4c1c17093461b58d3ee3f23f239e340d8dac1149 (patch) | |
tree | 236b724f1415a812a4274fd63b519124cba2e42f /server/lib/emailer.ts | |
parent | 45f1bd72a08998c60a9dd68ff069cea9de39161c (diff) | |
download | PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.gz PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.zst PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.zip |
Refactor email enabled function
Diffstat (limited to 'server/lib/emailer.ts')
-rw-r--r-- | server/lib/emailer.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 0f74d2a8c..d0874ab20 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { createTransport, Transporter } from 'nodemailer' | 1 | import { createTransport, Transporter } from 'nodemailer' |
2 | import { isTestInstance } from '../helpers/core-utils' | 2 | import { isTestInstance } from '../helpers/core-utils' |
3 | import { bunyanLogger, logger } from '../helpers/logger' | 3 | import { bunyanLogger, logger } from '../helpers/logger' |
4 | import { CONFIG } from '../initializers/config' | 4 | import { CONFIG, isEmailEnabled } from '../initializers/config' |
5 | import { JobQueue } from './job-queue' | 5 | import { JobQueue } from './job-queue' |
6 | import { EmailPayload } from './job-queue/handlers/email' | 6 | import { EmailPayload } from './job-queue/handlers/email' |
7 | import { readFileSync } from 'fs-extra' | 7 | import { readFileSync } from 'fs-extra' |
@@ -40,7 +40,7 @@ class Emailer { | |||
40 | if (this.initialized === true) return | 40 | if (this.initialized === true) return |
41 | this.initialized = true | 41 | this.initialized = true |
42 | 42 | ||
43 | if (Emailer.isEnabled()) { | 43 | if (isEmailEnabled) { |
44 | logger.info('Using %s:%s as SMTP server.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT) | 44 | logger.info('Using %s:%s as SMTP server.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT) |
45 | 45 | ||
46 | let tls | 46 | let tls |
@@ -459,7 +459,7 @@ class Emailer { | |||
459 | } | 459 | } |
460 | 460 | ||
461 | async sendMail (options: EmailPayload) { | 461 | async sendMail (options: EmailPayload) { |
462 | if (!Emailer.isEnabled()) { | 462 | if (!isEmailEnabled()) { |
463 | throw new Error('Cannot send mail because SMTP is not configured.') | 463 | throw new Error('Cannot send mail because SMTP is not configured.') |
464 | } | 464 | } |
465 | 465 | ||