Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 22 |
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 | SECRET_KEY: joi.string() |
||
7 | .required() |
||
8 | }).unknown() |
||
9 | .required() |
||
10 | |||
11 | const { error, value: envVars } = joi.validate(process.env, envVarsSchema) |
||
12 | if (error) { |
||
13 | throw new Error(`Config validation error: ${error.message}`) |
||
14 | } |
||
15 | |||
16 | const config = { |
||
17 | jwt: { |
||
18 | secret: envVars.SECRET_KEY |
||
19 | } |
||
20 | } |
||
21 | |||
22 | module.exports = config |
||
23 |