salix/services/print/application/config.js

23 lines
552 B
JavaScript
Raw Normal View History

2017-11-27 14:08:18 +00:00
var path = require('path');
2017-12-27 08:44:27 +00:00
let defaultFile = 'datasources.json';
2017-11-27 14:08:18 +00:00
2017-12-27 08:44:27 +00:00
function getFile(fileName) {
return require(path.join(__dirname, `/config/${fileName}`));
}
2017-11-27 14:08:18 +00:00
try {
2017-12-27 08:44:27 +00:00
let envFile = 'datasources.development.json';
2017-12-27 08:44:27 +00:00
if (process.env.NODE_ENV === 'test')
envFile = 'datasources.test.json';
config = getFile(envFile);
2017-11-27 14:08:18 +00:00
} catch (e) {
if (e.code == 'MODULE_NOT_FOUND')
2017-12-27 08:44:27 +00:00
config = getFile(defaultFile);
2017-11-27 14:08:18 +00:00
}
config.proxy = require('../../nginx/config.json');
config.package = require('../package.json');
module.exports = config;