Created
March 20, 2013 15:13
-
-
Save rowan-m/5205465 to your computer and use it in GitHub Desktop.
Pulling RDS config from an Elastic Beanstalk environment for Drupal
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 | |
// ---8<--- SNIP ---8<--- | |
if (isset( | |
$_SERVER['PARAM2'], $_SERVER['RDS_HOSTNAME'], $_SERVER['RDS_PORT'], $_SERVER['RDS_USERNAME'], $_SERVER['RDS_PASSWORD'] | |
)) { | |
$databases = array( | |
'default' => | |
array( | |
'default' => | |
array( | |
'database' => $_SERVER['PARAM2'], // Set by you in the EB container | |
'username' => $_SERVER['RDS_USERNAME'], | |
'password' => $_SERVER['RDS_PASSWORD'], | |
'host' => $_SERVER['RDS_HOSTNAME'], | |
'port' => $_SERVER['RDS_PORT'], | |
'driver' => 'mysql', | |
'prefix' => '', | |
), | |
), | |
); | |
} else { | |
$databases = array( | |
'default' => | |
array( | |
'default' => | |
array( | |
'database' => 'dev_db', | |
'username' => 'dev_user', | |
'password' => 'dev_password', | |
'host' => 'localhost', | |
'port' => '', | |
'driver' => 'mysql', | |
'prefix' => '', | |
), | |
), | |
); | |
} | |
// ---8<--- SNIP ---8<--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment