fixed config check for server

This commit is contained in:
Ulf Gebhardt 2019-06-03 23:19:50 +02:00
parent 15bfabcefd
commit 1a264a2662
No known key found for this signature in database
GPG Key ID: 44C888923CC8E7F3

View File

@ -1,7 +1,7 @@
import express from 'express'
import helmet from 'helmet'
import { GraphQLServer } from 'graphql-yoga'
import CONFIG from './config'
import { default as CONFIG, requiredConfigs } from './config'
import mocks from './mocks'
import middleware from './middleware'
import { getDriver } from './bootstrap/neo4j'
@ -9,7 +9,8 @@ import decode from './jwt/decode'
import schema from './schema'
// check required configs and throw error
Object.entries(CONFIG.requiredConfigs).map(entry => {
// TODO check this directly in config file - currently not possible due to testsetup
Object.entries(requiredConfigs).map(entry => {
if (!entry[1]) {
throw new Error(`ERROR: "${entry[0]}" env variable is missing.`)
}