Created
October 26, 2012 21:18
-
-
Save adampatterson/3961595 to your computer and use it in GitHub Desktop.
tentacle-appfog
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
<? if(!defined('DINGO')){die('External Access to File Denied');} | |
if ( getenv( "VCAP_SERVICES" ) ) { | |
$services_json = json_decode(getenv("VCAP_SERVICES"),true); | |
$mysql_config = $services_json["mysql-5.1"][0]["credentials"]; | |
$username = $mysql_config["username"]; | |
$password = $mysql_config["password"]; | |
$hostname = $mysql_config["hostname"]; | |
$db = $mysql_config["name"]; | |
config::set('db',array( | |
'default'=>array( | |
'driver'=>'mysql', | |
'host'=>$hostname, | |
'username'=>$username, | |
'password'=>$password, | |
'database'=>$db | |
) | |
)); | |
} else { | |
config::set('db',array( | |
'default'=>array( | |
'driver'=>'mysql', | |
'host'=>'localhost', | |
'username'=>'root', | |
'password'=>'root', | |
'database'=>'tentacle' | |
) | |
)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment