In my studio, we have successfully used multi-environment config files to allow several machines on our local network to use local MAMP installs as well as designate dev and production environments at our web host.
Locally we run sites on separate ports, so for instance to look at my site I point my browser to http://10.0.1.2:8081/
. To look at what’s going on on each other’s machines in the studio, we just change the ip address.
But now we are looking to run both a stable “trunk” version and a “branch” version for developing new features of our site on each local machine. And I can’t see how to make that work in the general.php and db.php files.
The following is what I’ve had in general.php for running a single instance of the site on my server:
'10.0.1.2' => array(
'userSessionDuration' => false,
'environmentVariables' => array(
'siteUrl' => 'http://10.0.1.2:8081/',
'fileSystemPath' => ‘/path/to/trunk/files/‘,
),
),
I feel that what I’d like to do is something like the following to differentiate between the two sites running on 10.0.1.2:
'10.0.1.2:8081’ => array(
'userSessionDuration' => false,
'environmentVariables' => array(
'siteUrl' => 'http://10.0.1.2:8081/',
'fileSystemPath' => ‘/path/to/trunk/files/‘,
),
),
'10.0.1.2:8082’ => array(
'userSessionDuration' => false,
'environmentVariables' => array(
'siteUrl' => 'http://10.0.1.2:8082/',
'fileSystemPath' => ‘/path/to/branch/files/‘,
),
),
Similarly, in the db.php file, currently I’ve got:
'10.0.1.2' => array(
'server' => 'localhost',
'user' => 'root',
'password' => 'root',
'database' => 'trunk.database’
),
Which I thought I’d change to:
'10.0.1.2:8081’ => array(
'server' => 'localhost',
'user' => 'root',
'password' => 'root',
'database' => 'trunk.database’
),
'10.0.1.2:8082’ => array(
'server' => 'localhost',
'user' => 'root',
'password' => 'root',
'database' => ‘branch.database’
),
But alas these kick off this error:
An exception has been thrown during the rendering of a template ("Craft can’t connect to the database with the credentials in craft/config/db.php.") in "_layout" at line 15.
Am I trying to do something impossible, or can anyone point me in the right direction?
Thank you much, Willhaus