require('require-yaml'); const fs = require('fs-extra'); const packageJson = require('../package.json'); let configPath = `/etc/${packageJson.name}`; let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; let config = require('./config/datasources.json'); let configFiles = [ `${configPath}/datasources.json`, `${configPath}/datasources.${env}.json` ]; for (let configFile of configFiles) { if (fs.existsSync(configFile)) Object.assign(config, require(configFile)); } let proxyConf = {}; let proxyFiles = [ '../../nginx/config.yml', `${configPath}/config.yml`, `${configPath}/config.${env}.yml` ]; for (let proxyFile of proxyFiles) { if (fs.existsSync(proxyFile)) Object.assign(proxyConf, require(proxyFile)); } config.proxy = proxyConf; config.package = packageJson; config.env = env; module.exports = config;