I'm curious what people use for accessing Express 3 settings (from get/set) in controllers and models. I know that I can access it through the request but I am not sure what the best approach is to access it outside of the routes such as in a model. I currently use a combination of app.set and app.get as well as a static array called settings that I require here:
Here's what I have right now:
// conf/configuration.js
var settings;
module.exports = function(app, express) {
app.set("root_dir", process.cwd() + "/");
app.set("public_dir", process.cwd() + "/public");
...
};
settings = {
foo: bar,
...
};
module.exports.settings = settings;
and in models I do
var settings = require("../conf/configuration").settings;
But I would like to do away with that settings array as I find the 2 methods a bit messy. Recommendation on how to access say 'root_dir' in a misc file?