-
Notifications
You must be signed in to change notification settings - Fork 498
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to force a reload of the config? #34
Comments
It is designed to have one config per application instance, with the singleton pattern used so different sub-modules can share a common configuration. In your case, you may be able to reset configs by setting environment variables, then calling It's not designed for that, but that might get you what you need. I'm hesitant to build-in support for multiple configs because it seems like a test-only situation. Let me know if that works for you. |
No, that doesnt work.
I understand the intent of the singleton - and the simplicity of use across modules. |
Here's another approach - The config module is cached by Node in the require module. Theoretically you should be able to remove all traces and reload by doing this within your loop:
Testing is very important - let me know how this works for you. |
That works with one small change. Instead of delete.require.cache.config, we need:
Thanks! |
Glad we came up with a solution - thanks for your help as well! |
I am writing a test for our various different configurations - to ensure that after all the different host/environment/etc configs are loaded and merged, we end up the final config we expect.
e.g.
_.each(configs, function(envConfig){
var actualConfig = require(envConfig);
var expectedConfig = readExpectedConfig(envConfig);
test.deepEqual(actualConfig, expectedConfig);
test.done();
})
(I'm manipulating environment variables to
However, I cant seem to load more than 1 config because of the singleton nature of it.
Is there a way to do it already?
If not, should we add one?
The text was updated successfully, but these errors were encountered: