Last active
October 11, 2015 19:08
-
-
Save mmoscosa/3905752 to your computer and use it in GitHub Desktop.
Select Database depending on environment, CakePHP
This file contains 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 | |
/** | |
* Automatically configure database connection. | |
*/ | |
public function __construct() { | |
$environment = Configure::read('environment'); | |
$operatingSystem = (DS === '/') ? 'Linux' : 'Windows'; | |
if ($environment === 'development') { | |
$this->default = $this->development; | |
} else { | |
$this->default = $this->production; | |
} | |
} | |
/** | |
* Default database. | |
*/ | |
public $default = null; | |
/** | |
* Development database. | |
*/ | |
public $development = array( | |
'driver' => 'Database/Mysql', | |
'host' => 'host', | |
'login' => 'login', | |
'password' => 'pass', | |
'database' => 'db', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment