Created
September 10, 2015 19:48
-
-
Save andyg5000/2512714886711080a56b to your computer and use it in GitHub Desktop.
Provides a local settings.php file for development
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 | |
$databases = array(); | |
$databases['default']['default'] = array( | |
'driver' => 'mysql', | |
'host' => 'mysql', | |
'username' => 'mysql', | |
'password' => 'mysql', | |
'database' => 'data', | |
'prefix' => '', | |
); | |
$conf['securepages_enable'] = FALSE; | |
$conf['file_public_path'] = 'sites/default/files'; | |
$conf['file_private_path'] = 'sites/default/files/private'; | |
$conf['file_temporary_path'] = '/tmp'; | |
$conf['cache'] = '0'; | |
$conf['preprocess_css'] = '0'; | |
$conf['preprocess_js'] = '0'; | |
// Disable cron! | |
$conf['cron_safe_threshold'] = 0; | |
$conf['mail_system'] = array( | |
'default-system' => 'DevelMailLog', | |
); | |
$conf['theme_debug'] = TRUE; | |
// If the site is bootstrapped via drush and docker available. | |
if (!empty($_SERVER['DOCKER_HOST'])) { | |
preg_match('([\w]+\.boi)', 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)); | |
// Database configuration. | |
$databases['default']['default'] = array( | |
'driver' => 'mysql', | |
'host' => 'db.boi', | |
'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