2019-01-22 08:55:35 +00:00
|
|
|
const fs = require('fs-extra');
|
2020-09-14 09:44:10 +00:00
|
|
|
const path = require('path');
|
2019-01-22 08:55:35 +00:00
|
|
|
let env = process.env.NODE_ENV ? process.env.NODE_ENV : 'development';
|
|
|
|
|
2019-01-22 10:48:00 +00:00
|
|
|
let configPath = `/etc/salix`;
|
2019-01-22 08:55:35 +00:00
|
|
|
let config = require('../config/print.json');
|
|
|
|
let configFiles = [
|
2020-11-09 13:52:25 +00:00
|
|
|
`../config/print.local.json`,
|
|
|
|
`../config/print.${env}.json`,
|
2019-01-22 08:55:35 +00:00
|
|
|
`${configPath}/print.json`,
|
2019-12-24 08:03:15 +00:00
|
|
|
`${configPath}/print.local.json`,
|
2019-01-22 08:55:35 +00:00
|
|
|
`${configPath}/print.${env}.json`
|
|
|
|
];
|
|
|
|
|
|
|
|
for (let configFile of configFiles) {
|
2020-09-14 10:14:22 +00:00
|
|
|
if (!configFile.includes(configPath))
|
|
|
|
configFile = path.join(__dirname, configFile);
|
|
|
|
|
2019-11-14 07:53:10 +00:00
|
|
|
if (fs.existsSync(configFile)) {
|
|
|
|
const conf = require(configFile);
|
|
|
|
for (let prop in conf)
|
|
|
|
Object.assign(config[prop], conf[prop]);
|
|
|
|
}
|
2019-01-22 08:55:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config.env = env;
|
|
|
|
module.exports = config;
|