diff --git a/config.js b/config.js index 3d46aa71..21681a81 100644 --- a/config.js +++ b/config.js @@ -187,7 +187,3 @@ module.exports = { certificate: "" } }; - -if ("SHOUT_CONFIG" in process.env) { - module.exports = require(process.env.SHOUT_CONFIG); -} diff --git a/src/helper.js b/src/helper.js index d616592b..9c5b11a9 100644 --- a/src/helper.js +++ b/src/helper.js @@ -1,13 +1,21 @@ +var fs = require("fs"); var path = require("path"); var Helper = module.exports = { getConfig: function () { - return require(path.resolve(__dirname, "..", "config")); + var filename = process.env.SHOUT_CONFIG; + if(!filename || !fs.exists(filename)) { + filename = this.resolveHomePath("config.js"); + if(!fs.exists(filename)) { + filename = path.resolve(__dirname, "..", "config"); + } + } + return require(filename); }, getHomeDirectory: function () { return ( - this.getConfig().home + (process.env.SHOUT_CONFIG && fs.exists(process.env.SHOUT_CONFIG) && this.getConfig().home) || process.env.SHOUT_HOME || path.resolve(process.env.HOME, ".shout") );