I'm working on a node.js project where a lot of modules require a configuration file. At the moment I'm requiring the config file in each module, is it the best way of doing it? I've thought about setting the config as a global but it looks "dirty". Here's the file for now (do not mind the structure for now, it's still in development)
{
"root" : "undefined",
"jwtAuthentication": {
"appSecret": "XXXXXXXXXXXXX",
"expiration": "48h"
},
"authorization": {
"guestActions": [ "signup" ]
}
}
Here is how I set my project structure:
module1
--controllers
--services
--middleware
--config
module2
--controllers
--services
--middleware
--config
shared
--config
--services
In shared/config I set global configuration and in module{i} configuration specific to that module.