Move config.js into the Shout home directory by default

This commit is contained in:
Shell Turner 2014-10-01 18:13:37 +02:00
parent 7e4534afa9
commit 791a5914df
2 changed files with 10 additions and 6 deletions

View File

@ -187,7 +187,3 @@ module.exports = {
certificate: ""
}
};
if ("SHOUT_CONFIG" in process.env) {
module.exports = require(process.env.SHOUT_CONFIG);
}

View File

@ -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")
);