Open smart--petea opened 10 years ago
@smart--petea I'm not sure I understand the issue here.
The best solution for this scenario, would be to have a custom json file, with the shared configuration values, and then, each project would load that json, add the custom config values (like port) and then pass that new json to Vatican's constructor.
Something like this:
var vat = require("vatican");
var genericConfig = require("../shared-folder/config.json")
genericConfig.port = 2000 ///each project would customize this attribute
var app = new vat(genericConfig);
//....
I previously mention that if application will be run from one folder which is not intended by developer as root folder then process.cwd
will not point correctly to root folder. Such cases can be
node /path/index.js
Why do not let to user to use at the same time the options and config? This is flexibile.
There can be the situation then same vatican-conf.json must be shared between some vatican instances (each in different directory).
For this case will be good (like issue #26) to use
context
context
)At this time constructor of Vatican looks like
and has a very rigid behaviour (from
options
point of view) because inoptions
can be fields that are not inconfig
and fields that are not inoptions
.Maybe to define a new
options.config
which can match one of the casesconfig
will be read relative to current contextconfig
will be not read (considered equal to{}
)options