config/components/jwt.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 22
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 22
rs 10
bpm 0
cpm 0
noi 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