Last active
March 25, 2019 20:22
-
-
Save doostinharrell/1f4a9551a7ceaa25b2b2785b025bde60 to your computer and use it in GitHub Desktop.
Drupal 6 settings.php
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 | |
// Database configuration. | |
$db_host = 'database'; | |
$db_username = 'drupal6'; | |
$db_password = 'drupal6'; | |
$db_database = 'drupal6'; | |
$db_url = 'mysql://' . $db_username . ':' . $db_password . '@' . $db_host . '/' . $db_database; | |
// Update settings.php for local lando dev. | |
if (!empty($_SERVER['DOCKER_DEV'])) { | |
preg_match('([\w-]+\.[\w]+)', getcwd(), $project_root); | |
preg_match('(^[\w-]+)', $project_root[0], $dir_root); | |
$container = str_replace('-', '', $dir_root[0]); | |
$cmd = "/usr/local/bin/docker port " . $container . "_database_1 3306 | grep -Eo '\d+$'"; | |
$port = trim(shell_exec($cmd)); | |
// Set $base_url variable. | |
if (!empty($project_root)) { | |
GLOBAL $base_url; | |
$base_url = 'http://' . $dir_root[0] . '.lndo.site'; | |
} | |
// Database configuration. | |
$db_host = '0.0.0.0'; | |
$db_username = 'drupal6'; | |
$db_password = 'drupal6'; | |
$db_database = 'drupal6'; | |
$db_url = 'mysql://' . $db_username . ':' . $db_password . '@' . $db_host . ':' . $port . '/' . $db_database; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment