Skip to content

Instantly share code, notes, and snippets.

@jcowher
Created November 1, 2019 13:19
Show Gist options
  • Save jcowher/11539e5e857f301c1cc76ff7c061cdea to your computer and use it in GitHub Desktop.
Save jcowher/11539e5e857f301c1cc76ff7c061cdea to your computer and use it in GitHub Desktop.
Local settings.php for Drupal 8
<?php
/**
* Display all PHP errors.
*/
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
/**
* Enable development services.
*/
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/blt.development.services.yml';
/**
* Disable render cache.
*/
$settings['cache']['bins']['render'] = 'cache.backend.null';
/**
* Disable dynamic page cache.
*/
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
/**
* Disable caching for migrations. This will store migrations in memory and not
* in the database, making it easier to develop custom migrations.
*/
$settings['cache']['bins']['discovery_migration'] = 'cache.backend.memory';
/**
* Skip file system permissions hardening.
*
* The system module will periodically check the permissions of your site's
* site directory to ensure that it is not writable by the website user. For
* sites that are managed with a version control system, this can cause problems
* when files in that directory such as settings.php are updated, because the
* user pulling in the changes won't have permissions to modify files in the
* directory.
*/
$settings['skip_permissions_hardening'] = TRUE;
/**
* Disable simplesaml locally
*/
$config['simplesamlphp_auth.settings']['activate'] = FALSE;
/**
* Disable mail locally
*/
$config['system.mail']['interface']['default'] = 'test_mail_collector';
/**
* Show all error messages, with backtrace information.
*
* In case the error level could not be fetched from the database, as for
* example the database connection failed, we rely only on this value.
*/
$config['system.logging']['error_level'] = 'all';
/**
* System performance.
*/
$config['system.performance']['cache']['page']['use_internal'] = FALSE;
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['css']['gzip'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
$config['system.performance']['js']['gzip'] = FALSE;
$config['system.performance']['response']['gzip'] = FALSE;
/**
* Views settings.
*/
$config['views.settings']['ui']['sql_query']['enabled'] = TRUE;
$config['views.settings']['ui']['show']['performance_statistics'] = TRUE;
/**
* Solr config.
$config['search_api.server.pantheon']['dependencies']['module'] = ['search_api_solr'];
$config['search_api.server.pantheon']['backend'] = 'search_api_solr';
$config['search_api.server.pantheon']['backend_config'] = [
'connector' => 'standard',
'connector_config' => [
'scheme' => 'http',
'host' => 'solr.bostoninteractive.com',
'port' => '8983',
'path' => '/solr',
'core' => '', // Set to your core
'timeout' => 5,
'index_timeout' => 5,
'optimize_timeout' => 10,
'commit_within' => 1000,
'solr_version' => '',
'http_method' => 'AUTO',
],
'retrieve_data' => FALSE,
'highlight_data' => FALSE,
'excerpt' => FALSE,
'skip_schema_check' => FALSE,
'site_hash' => FALSE,
'suggest_suffix' => TRUE,
'suggest_corrections' => TRUE,
'suggest_words' => FALSE,
];
*/
/**
* Disable shield.
*/
$config['shield.settings']['user'] = '';
/**
* Disable CDN
*/
$config['cdn.settings']['status'] = FALSE;
/**
* Set temp directory.
*/
$config['system.file']['path']['temporary'] = '/tmp';
/**
* Database settings.
*/
$databases['default']['default'] = [
'database' => 'default',
'username' => 'user',
'password' => 'user',
'host' => 'db',
'driver' => 'mysql',
'prefix' => '',
'collation' => 'utf8mb4_general_ci',
];
/**
* Trusted host patterns.
*/
$settings['trusted_host_patterns'][] = '^.+$';
/**
* Private files.
*/
$settings['file_private_path'] = '/var/www/private';
/**
* Reverse proxy config.
*/
if (PHP_SAPI !== 'cli') {
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = [$_SERVER['REMOTE_ADDR']];
// HTTPS behind reverse-proxy
if (
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' &&
!empty($settings['reverse_proxy']) && in_array($_SERVER['REMOTE_ADDR'], $settings['reverse_proxy_addresses'])
) {
$_SERVER['HTTPS'] = 'on';
// This is hardcoded because there is no header specifying the original port.
$_SERVER['SERVER_PORT'] = 443;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment