Skip to content

Instantly share code, notes, and snippets.

@elliotttf
Forked from rupl/settings.php
Created August 22, 2011 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotttf/1162605 to your computer and use it in GitHub Desktop.
Save elliotttf/1162605 to your computer and use it in GitHub Desktop.
Allows regular drush commands without -l arg when using super awesome dynamic vhost
<?php
/**
* Allow developers to override settings.
*/
define('SWEET_ASS_LIVE_SETTINGS_REGEX', '/^(.*)drupalcampaustin.org(:\d+)*$/');
define('SWEET_ASS_STAGE_SETTINGS_REGEX', '/^(dca11\.webchefs\.org|dca11\.dev1\.fourkitchens\.com)(:\d+)*$/');
if (preg_match(SWEET_ASS_LIVE_SETTINGS_REGEX, $_SERVER['HTTP_HOST'], $matches)) {
if (file_exists('sites/default/settings.live.php')) {
include_once 'sites/default/settings.live.php';
}
}
elseif (preg_match(SWEET_ASS_STAGE_SETTINGS_REGEX, $_SERVER['HTTP_HOST'])) {
if (file_exists('sites/default/settings.stage.php')) {
include_once 'sites/default/settings.stage.php';
}
}
else {
// Load general dev settings.
if (file_exists('sites/default/settings.dev.php')) {
include_once 'sites/default/settings.dev.php';
}
// Load user settings.
if (file_exists('sites/default/settings_' . getenv(USER) . '.php')) {
include_once 'sites/default/settings_' . getenv(USER) . '.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment