-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
process: make process.config read-only #6123
Conversation
CI: https://ci.nodejs.org/job/node-test-pull-request/2226/ |
we probably need to do a bit of extended research on this one |
Yep, this one is going to be just a bit problematic. There are a handful of modules that mutate Salem (https://www.npmjs.com/package/salem) is a good example. Take a look at the example given: var salem = require('salem');
var configClient = salem.createClient({
url: 'http://localhost:8080',
env: process.env.NODE_ENV || 'development'
});
//
// Load the configuration for use within the application.
//
configClient.loadConfig(function (err, config) {
if (err) throw err;
process.config = config;
}); Some of these add keys to the Digging in further... It also looks like this could break node-gyp which does some stuff with process.config internally. |
@jasnell what if we just keep our own internal copy? |
Yep, that would work. |
Essentially, we'd be conceding the |
Yep, CI broken all over
|
Given the results I'm going to close this and look at tackling the problem a different way. |
Checklist
Affected core subsystem(s)
process
Description of change
Makes
process.config
read-only using a getter/setter and freezing the objects on JSON.parse. Does result in a perf hit butprocess.config
is not used in any critical paths (or any path in core) for that matter. There are apparently some places in user land where this is being extended and it causes problems when we want to add new configuration options (see #6115 for an example).Refs: #6115
/cc @Fishrock123