Uh oh!
There was an error while loading. Please reload this page.
process: make process.config read-only - #6123
Conversation
claudiorodriguez
commented
Apr 8, 2016
CI: https://ci.nodejs.org/job/node-test-pull-request/2226/ |
Fishrock123
commented
Apr 8, 2016
we probably need to do a bit of extended research on this one |
jasnell
commented
Apr 8, 2016
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: varsalem=require('salem');varconfigClient=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)throwerr;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. |
Fishrock123
commented
Apr 9, 2016
@jasnell what if we just keep our own internal copy? |
jasnell
commented
Apr 9, 2016
Yep, that would work. |
jasnell
commented
Apr 9, 2016
Essentially, we'd be conceding the |
claudiorodriguez
commented
Apr 9, 2016
Yep, CI broken all over |
jasnell
commented
Apr 9, 2016
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.configread-only using a getter/setter and freezing the objects on JSON.parse. Does result in a perf hit butprocess.configis 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