const fs = require('fs-extra'); const path = require('path'); let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; let configPath = `/etc/salix`; let config = require('../config/print.json'); let configFiles = [ `../config/print.local.json`, `../config/print.${env}.json`, `${configPath}/print.json`, `${configPath}/print.local.json`, `${configPath}/print.${env}.json` ]; for (let configFile of configFiles) { const filePath = path.join(__dirname, configFile); if (fs.existsSync(filePath)) { const conf = require(filePath); for (let prop in conf) Object.assign(config[prop], conf[prop]); } } config.env = env; module.exports = config;