visionmedia/express — pull request #1113 by bobbydavid (2012-04-26 05:15:16+00:00)
Title: special handling of app.set() config objects

Previous behavior was to overwrite objects, but it makes much more sense
for a configuration file to merge the new object with the existing one.

This allows for things like:

app.set('tv settings', { channel: 42 });
app.set('tv settings', { volume: 100 });
app.get('tv settings');
// => { channel: 42, volume: 100 }

This seems much more intuitive, and avoids confusing bugs like:

app.configure(function(){
app.set('view options', { layout: false });
});
app.configure('development', function(){
app.set('view options', { pretty: true });
});
// => In development config, layout: true !?!?

But it's a public API change. Conceivably some websites may rely on the above behavior. But it seems really insidious and misleading, and probably the following is more common:

app.configure(function(){
app.set('view options', { layout: false });
});
app.configure('development', function(){
app.set('view options', { layout: false, pretty: true });
});

which won't break from these changes -- it will just be redundant.