allow for .js config

This commit is contained in:
Laura Carvajal
2016-10-17 12:12:55 +01:00
committed by Rowan Manning
parent c2b1b1d1a1
commit 344efb9da3

View File

@@ -18,9 +18,12 @@
const fs = require('fs');
const environment = (process.env.NODE_ENV || 'development');
const jsonPath = `./config/${environment}.json`;
const jsPath = `./config/${environment}.js`;
if (fs.existsSync(jsonPath)) {
module.exports = require(jsonPath);
} else if (fs.existsSync(jsPath)) {
module.exports = require(jsPath);
} else {
module.exports = {
port: Number(env('PORT', '4000')),