I’m using a method similar to #1, but in PHP, enabling me to set up arbitrary conditions and “trickle down effects” on the configuration. It checks domain and other conditions to control what configuration is expressed in a specific installation. That means different domains (test, staging, production) can run the exact same code (from a source code point of view) with the exact same database content, making “roll-over” very easy. I can also set global debug and performance flags for the whole system, so I could perform e.g. performance testing on staging while that flag will automatically not be set when moving to production. It works for me.