1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 5x 5x 21x 7x 21x 21x 106x 21x | const extend = require('extend'); // deep clone, not like shallow Object.assign module.exports = (config, user) => { // If it's a number it's the port if (typeof user === 'number') { user = { port: user }; } let options = extend(true, {}, config, user); // Overwrite with the env variables if set for (let key in options) { Iif (key.toUpperCase().replace(/\s/g, '_') in process.env) { options[key] = process.env[key.toUpperCase().replace(/\s/g, '_')]; } } return options; } |