Skip to content

Instantly share code, notes, and snippets.

@doostinharrell
Last active December 13, 2017 16:31
Show Gist options
  • Save doostinharrell/7c6f93f4f88b36324d7ed47b422fac2d to your computer and use it in GitHub Desktop.
Save doostinharrell/7c6f93f4f88b36324d7ed47b422fac2d to your computer and use it in GitHub Desktop.
Drupal 7 settings.php
<?php
// Database configuration.
$databases = array();
$databases['default']['default'] = array(
'driver' => 'mysql',
'host' => 'mysql',
'username' => 'mysql',
'password' => 'mysql',
'database' => 'data',
'prefix' => '',
);
// Disable Secure Pages module.
$conf['securepages_enable'] = FALSE;
// Disable Secure Login module.
$conf['securelogin_form_user_login'] = FALSE;
$conf['securelogin_form_user_login_block'] = FALSE;
$conf['securelogin_form_user_pass_reset'] = FALSE;
$conf['securelogin_form_user_register_form'] = FALSE;
// Disabled Security Kit XSS locally.
$conf['seckit_xss'] = [];
// Set local file paths.
$conf['file_public_path'] = 'sites/default/files';
$conf['file_private_path'] = 'sites/default/files/private';
$conf['file_temporary_path'] = 'sites/default/files/tmp';
// Disable caching.
$conf['cache'] = '0';
$conf['preprocess_css'] = '0';
$conf['preprocess_js'] = '0';
// Disable cron.
$conf['cron_safe_threshold'] = 0;
// Enable devel mail to prevent emails from being sent.
$conf['mail_system'] = array(
'default-system' => 'DevelMailLog',
);
// Re-route all emails sent via the smtp module.
$conf['smtp_reroute_address'] = '[email protected]';
// Enable theme debugging.
$conf['theme_debug'] = TRUE;
// Set drupal hash salt.
$drupal_hash_salt = 'hash';
// If the site is bootstrapped via drush and docker available.
if (!empty($_SERVER['DOCKER_DEV'])) {
preg_match('([\w]+\.invalid)', getcwd(), $matches);
if (empty($matches[0])) {
print "Unable to set mysql port for drush commands. Check settings.php!\n";
}
$project = $matches[0];
$name = str_replace('.', '', $project);
$cmd = "/usr/local/bin/docker port " . $name . "_mysql_1 3306 | grep -Eo '\d+$'";
$port = trim(shell_exec($cmd));
// Set $base_url variable.
if (!empty($project)) {
GLOBAL $base_url;
$base_url = 'http://' . $project;
}
// Database configuration.
$databases['default']['default'] = array(
'driver' => 'mysql',
'host' => '0.0.0.0',
'port' => $port,
'username' => 'mysql',
'password' => 'mysql',
'database' => 'data',
'prefix' => '',
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment