Created
October 26, 2013 20:23
-
-
Save jasonmccallister/7174098 to your computer and use it in GitHub Desktop.
My Craft db.php configuration for AppFog.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Database Configuration | |
* | |
* All of your system's database configuration settings go in here. | |
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php | |
*/ | |
if ($_SERVER['HTTP_HOST'] == 'local.domainname.com') { | |
$var_servername = ''; | |
$var_username = ''; | |
$var_password = ''; | |
$var_database = ''; | |
} else { | |
$services_json = json_decode(getenv("VCAP_SERVICES"),true); | |
$mysql_config = $services_json["mysql-5.1"][0]["credentials"]; | |
$var_servername = $mysql_config["hostname"]; | |
$var_username = $mysql_config["username"]; | |
$var_password = $mysql_config["password"]; | |
$var_database = $mysql_config["name"]; | |
} | |
return array( | |
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'. | |
'server' => $var_servername, | |
// The database username to connect with. | |
'user' => $var_username, | |
// The database password to connect with. | |
'password' => $var_password, | |
// The name of the database to select. | |
'database' => $var_database, | |
// The prefix to use when naming tables. This can be no more than 5 characters. | |
'tablePrefix' => 'craft', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment