Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Fix settings.docker.demo.php for Docker Compose v2, memcached #475

Merged
merged 2 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions assets/sites/default/settings.docker.demo.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?php

if (getenv('DB_1_ENV_MYSQL_DATABASE')) {
$databases = array (
if (getenv('DB_1_ENV_MYSQL_DATABASE') != FALSE || getenv('MYSQL_DATABASE') != FALSE) {
$databases = array(
'default' =>
array (
array(
'default' =>
array (
'database' => getenv('DB_1_ENV_MYSQL_DATABASE'),
'username' => getenv('DB_1_ENV_MYSQL_USER'),
'password' => getenv('DB_1_ENV_MYSQL_PASSWORD'),
'host' => getenv('DB_1_PORT_3306_TCP_ADDR'),
array(
'database' => (getenv('MYSQL_DATABASE') != FALSE) ? getenv('MYSQL_DATABASE') : getenv('DB_1_ENV_MYSQL_DATABASE'),
'username' => (getenv('MYSQL_USER') != FALSE) ? getenv('MYSQL_USER') : getenv('DB_1_ENV_MYSQL_USER'),
'password' => (getenv('MYSQL_PASSWORD') != FALSE) ? getenv('MYSQL_PASSWORD') : getenv('DB_1_ENV_MYSQL_PASSWORD'),
'host' => (getenv('DB_1_PORT_3306_TCP_ADDR') != FALSE) ? getenv('DB_1_PORT_3306_TCP_ADDR') : 'db',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);

# Workaround for permission issues with NFS shares in Vagrant
// Workaround for permission issues with NFS shares in Vagrant.
$conf['file_chmod_directory'] = 0777;
$conf['file_chmod_file'] = 0666;

Expand All @@ -32,8 +32,13 @@
}
}

if (getenv('MEMCACHED_PORT_11211_TCP_ADDR')) {
$memcache_server = getenv('MEMCACHED_PORT_11211_TCP_ADDR') . ':' . getenv('MEMCACHED_PORT_11211_TCP_PORT');
if (getenv('HOSTNAME') == 'web' || getenv('MEMCACHED_PORT_11211_TCP_ADDR') != FALSE) {
if (getenv('MEMCACHED_PORT_11211_TCP_ADDR') != FALSE) {
$memcache_server = getenv('MEMCACHED_PORT_11211_TCP_ADDR') . ':' . getenv('MEMCACHED_PORT_11211_TCP_PORT');
}
else {
$memcache_server = 'memcached:11211';
}
$conf['memcache_servers'] = array($memcache_server => 'default');
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
Expand Down
17 changes: 9 additions & 8 deletions assets/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@
* to configure more complex environment setups, or with custom hosting
* companies beside acquia and pantheon.
*/
$settings_local = DRUPAL_ROOT . '/' . conf_path() . '/settings.local.php';
$settings_docker = DRUPAL_ROOT . '/' . conf_path() . '/settings.docker.php';
if (file_exists($settings_local)) {
include $settings_local;
}
elseif (file_exists($settings_docker)) {
include $settings_docker;
}

/**
* Include config file from config folder.
Expand All @@ -34,6 +26,15 @@
include $config_file;
}

$settings_local = DRUPAL_ROOT . '/' . conf_path() . '/settings.local.php';
$settings_docker = DRUPAL_ROOT . '/' . conf_path() . '/settings.docker.php';
if (file_exists($settings_local)) {
include $settings_local;
}
elseif (file_exists($settings_docker)) {
include $settings_docker;
}

/**
* Validation function to check if variable is available.
*/
Expand Down