[horde] database switching between dev and production

Greg Rundlett Greg.Rundlett at savaJe.com
Wed Jul 13 12:06:23 PDT 2005


I'm wondering what is the recommended way of switching db backends based 
on hostname?

I've got a development repository and a production repository with the 
same code in both and I want to be able to test with separate db 
backends so that real data doesn't get polluted.

I was thinking I could use a hack like this in the _connect method of my 
db factory class

            /**
             * hack to enable database switching on-the-fly based on the 
webserver host
             */
            $thisHost = $_SERVER['HTTP_HOST'];
            switch ($thisHost) {
                case 'ab.dev.savaje.com':
                    $this->_params['database'] = 'horde-dev';
                    break;
                default:
                    $this->_params['database'] = 'horde';
                    break;
            }  

-- 
Greg Rundlett

Release Engineering Team
SavaJe Technologies
(978) 259-2029

[random sig fortune]
Syntactic sugar causes cancer of the semicolon.
		-- Epigrams in Programming, ACM SIGPLAN Sept. 1982

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Greg.Rundlett.vcf
Type: text/x-vcard
Size: 334 bytes
Desc: not available
Url : http://lists.horde.org/archives/horde/attachments/20050713/ef418dba/Greg.Rundlett.vcf


More information about the horde mailing list