config/components/mailer.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 25
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
wmc 1
c 1
b 0
f 0
nc 1
mnd 1
bc 1
fnc 0
dl 0
loc 25
rs 10
bpm 0
cpm 0
noi 0
1
'use strict'
2
3
import joi from 'joi'
4
5
const envVarsSchema = joi.object({
6
  MAILER_USER: joi.string()
7
    .required(),
8
  MAILER_KEY: joi.string()
9
    .required()
10
}).unknown()
11
  .required()
12
13
const { error, value: envVars } = joi.validate(process.env, envVarsSchema)
14
if (error) {
15
  throw new Error(`Config validation error: ${error.message}`)
16
}
17
18
const config = {
19
  mailer: {
20
    user: envVars.MAILER_USER,
21
    key: envVars.MAILER_KEY
22
  }
23
}
24
25
module.exports = config
26