Created
September 26, 2014 16:48
-
-
Save gormus/fccdda05db2058fdc236 to your computer and use it in GitHub Desktop.
Additional configuration options for the Pantheon platform. Append this gist to your project's settings.php and modify as needed.
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 | |
/** | |
* @file | |
* Drupal site-specific configuration file. | |
*/ | |
/** | |
* Redirect to a common domain. | |
*/ | |
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && ($_SERVER['PANTHEON_ENVIRONMENT'] == 'live')) { | |
if ($_SERVER['HTTP_HOST'] == 'example.com' || | |
$_SERVER['HTTP_HOST'] == 'live-example.gotpantheon.com') { | |
header('HTTP/1.0 301 Moved Permanently'); | |
header('Location: http://www.example.com'. $_SERVER['REQUEST_URI']); | |
exit(); | |
} | |
} | |
/** | |
* Platform specific settings. | |
* | |
* @see http://helpdesk.getpantheon.com/customer/portal/articles/708588 | |
*/ | |
if (defined('PANTHEON_ENVIRONMENT')) { | |
// Performance settings. | |
// Production environment configuration. | |
if (PANTHEON_ENVIRONMENT == 'live') { | |
// Anonymous caching - enabled. | |
$conf['cache'] = 1; | |
// Block caching - enabled. | |
$conf['block_cache'] = 1; | |
// Expiration of cached pages - 15 minutes. | |
$conf['page_cache_maximum_age'] = 900; | |
// Aggregate and compress CSS files in Drupal - on. | |
$conf['preprocess_css'] = 1; | |
// Aggregate JavaScript files in Drupal - on. | |
$conf['preprocess_js'] = 1; | |
// minify HTML. | |
$conf['minify_html'] = 1; | |
// Use Minified JavaScript files. | |
$conf['minify_js'] = 1; | |
} | |
// Development environment configuration. | |
else { | |
// Anonymous caching. | |
$conf['cache'] = 0; | |
// Block caching - disabled. | |
$conf['block_cache'] = 0; | |
// Expiration of cached pages - none. | |
$conf['page_cache_maximum_age'] = 0; | |
// Aggregate and compress CSS files in Drupal - off. | |
$conf['preprocess_css'] = 0; | |
// Aggregate JavaScript files in Drupal - off. | |
$conf['preprocess_js'] = 0; | |
// minify HTML. | |
$conf['minify_html'] = 0; | |
// Use Minified JavaScript files. | |
$conf['minify_js'] = 0; | |
} | |
// Minimum cache lifetime - always none. | |
$conf['cache_lifetime'] = 0; | |
// Cached page compression - always off. | |
$conf['page_compression'] = 0; | |
# // Other settings. | |
# if (PANTHEON_ENVIRONMENT == 'dev') { | |
# // Google Analytics. | |
# $conf['googleanalytics_account'] = 'UA-XXXXXXXX-X'; | |
# } | |
# else if (PANTHEON_ENVIRONMENT == 'test') { | |
# // Google Analytics. | |
# $conf['googleanalytics_account'] = 'UA-XXXXXXXX-Y'; | |
# } | |
# else if (PANTHEON_ENVIRONMENT == 'live') { | |
# // Google Analytics. | |
# $conf['googleanalytics_account'] = 'UA-XXXXXXXX-Z'; | |
# } | |
} | |
else { | |
// Database configuration for local development. | |
$databases['default']['default'] = array( | |
'database' => 'DATABASE', | |
'username' => 'USERNAME', | |
'password' => 'PASSWORD', | |
'host' => 'localhost', | |
'driver' => 'mysql', | |
'port' => 3306, | |
'prefix' => '', | |
); | |
} | |
/** | |
* Redis cache settings for Pantheon. | |
* | |
* @see http://helpdesk.getpantheon.com/customer/portal/articles/401317-understanding-redis-cache | |
*/ | |
# if (defined('PANTHEON_ENVIRONMENT')) { | |
# // Following is required for all Pantheon environments using Redis. | |
# $conf['redis_client_interface'] = 'PhpRedis'; | |
# $conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc'; | |
# $conf['path_inc'] = 'sites/all/modules/contrib/redis/redis.path.inc'; | |
# $conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc'; | |
# $conf['cache_default_class'] = 'Redis_Cache'; | |
# $conf['cache_prefix'] = array('default' => 'pantheon-redis-' . $_SERVER['PANTHEON_ENVIRONMENT']); | |
# // Do not use Redis for cache_form (no performance difference). | |
# $conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; | |
# | |
# // Following settings are optional. DO NOT USE BOTH AT THE SAME TIME. | |
# // | |
# // Option A: | |
# // ========= | |
# // Higher performance for smaller page counts. This technique does not execute | |
# // full Drupal bootstrapping and does not invoke the database, which ignores | |
# // database checks such as Drupal's IP blacklist. | |
# // | |
# // High performance - no hook_boot(), no hook_exit(), ignores Drupal IP blacklists. | |
# # $conf['page_cache_without_database'] = TRUE; | |
# # $conf['page_cache_invoke_hooks'] = FALSE; | |
# // Explicitly set page_cache_maximum_age as database won't be available. | |
# # $conf['page_cache_maximum_age'] = 900; | |
# // | |
# // Option B: | |
# // ========= | |
# // Higher hit rate for larger page counts. This technique avoids evictions due | |
# // to redis space limitations when your site has a large quantity of pages to | |
# // cache. Will conflict with Option A which skips the database entirely. | |
# // | |
# // Use the database for cached HTML. | |
# $conf['cache_class_cache_page'] = 'DrupalDatabaseCache'; | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment