Skip to content

Instantly share code, notes, and snippets.

@Da-Fecto
Created November 19, 2015 09:16
Show Gist options
  • Save Da-Fecto/2807995bc9c57300bc21 to your computer and use it in GitHub Desktop.
Save Da-Fecto/2807995bc9c57300bc21 to your computer and use it in GitHub Desktop.
Conditional SQL on config
/**
* Installer: HTTP Hosts Whitelist
*
*/
$config->httpHosts = array('domain-01.dev', 'domain-02.dev', 'domain-03.dev', 'domain-04.ext');
/**
* Development settings (Switch settings based on domainname.)
*
*/
$config->develop_domains = array(
'domain-01.dev',
'domain-02.dev',
'domain-03.dev',
);
// Default Live
$config->dbHost = 'localhost';
$config->dbName = 'domain-04-db';
$config->dbUser = 'username';
$config->dbPass = 'password';
$config->dbPort = '3306';
if (isset($_SERVER['HTTP_HOST']) && in_array($_SERVER['HTTP_HOST'], $config->develop_domains)) {
/**
* Database Configuration development environment(s).
*
*/
// Develop
if ($_SERVER['HTTP_HOST'] == 'domain-01.dev') {
$config->dbHost = 'localhost';
$config->dbName = 'domain-01-db';
$config->dbUser = 'username';
$config->dbPass = 'password';
$config->dbPort = '3306';
// Other place
} else if ($_SERVER['HTTP_HOST'] == 'domain-02.dev') {
$config->dbHost = 'localhost';
$config->dbName = 'domain-02.dev';
$config->dbUser = 'username';
$config->dbPass = 'password';
$config->dbPort = '3306';
// Yet an other place
} else if ($_SERVER['HTTP_HOST'] == 'domain-03.dev') {
$config->dbHost = 'localhost';
$config->dbName = 'domain-03.dev';
$config->dbUser = 'username';
$config->dbPass = 'password';
$config->dbPort = '3306';
}
$config->adminEmail = array("[email protected]", "[email protected]");
$config->advanced = true;
$config->debug = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment