Created
October 4, 2013 03:12
-
-
Save skwashd/6820419 to your computer and use it in GitHub Desktop.
It is very useful to have different Drupal configurations in different environments. The easiest way to do this is via setting values in the $conf array in settings.php. For my site builds I generally create a sites/default/config directory that contains the per environment settings. When working with Acquia Cloud and Pantheon the db credentials…
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
<?php | |
/** | |
* Example settings.php which supports per environment configs on different hosting platforms. | |
*/ | |
$include = ''; | |
// Pantheon | |
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) { | |
$include = __DIR__ . "/config/settings.{$_SERVER['PANTHEON_ENVIRONMENT']}.php"; | |
} | |
// Acquia | |
elseif (isset($_ENV['AH_SITE_ENVIRONMENT'])) { | |
$include = __DIR__ . "/config/settings.{$_ENV['AH_SITE_ENVIRONMENT']}.php"; | |
} | |
// Local dev | |
else { | |
// local extends dev but is excluded from the repo via .gitignore | |
$include = __DIR__ . '/config/settings.local.php'; | |
} | |
// Check the file exists as it might not have been created yet. | |
if (file_exists($include)) { | |
require_once $include; | |
} |
@agold2 error_level, site_name and environment_indicator_text are 3 right off the top of my head. DB credentials are another.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing. Would you mind also sharing some examples of what kind of settings you are changing per environment?