Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 25 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |