From 68356701a975d2fd624040c0d99c3ad7be15bf15 Mon Sep 17 00:00:00 2001 From: Simon Lindsay Date: Fri, 1 Sep 2017 13:58:47 +0930 Subject: [PATCH 1/2] Adding config setup for redis. --- src/Handler.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Handler.php b/src/Handler.php index 36bb45d..87c1b67 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -139,6 +139,20 @@ public function createSettingsFile() "\$settings['shepherd_site_id'] = getenv('SHEPHERD_SITE_ID');\n" . "\$settings['shepherd_url'] = getenv('SHEPHERD_URL');\n" . "\$settings['shepherd_token'] = getenv('SHEPHERD_TOKEN_FILE') ? file_get_contents(getenv('SHEPHERD_TOKEN_FILE')) : getenv('SHEPHERD_TOKEN');\n" . + "if (getenv('REDIS_ENABLED')) {\n" . + " \$settings['redis.connection']['interface'] = 'PhpRedis';\n" . + " \$settings['redis.connection']['host'] = 'redis';\n" . + " \$settings['cache']['default'] = 'cache.backend.redis';\n\n" . + " // Always set the fast backend for bootstrap, discover and config, otherwise\n" . + " // this gets lost when redis is enabled.\n" . + " \$settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';\n" . + " \$settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';\n" . + " \$settings['cache']['bins']['config'] = 'cache.backend.chainedfast';\n\n" . + " // If we're not installing, include the redis services." . + " if (!isset($GLOBALS['install_state'])) {\n" . + " \$settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';\n" . + " }\n" . + "}\n" . "/**\n * END SHEPHERD CONFIG\n */\n" . "\n" . "/**\n * START LOCAL CONFIG\n */\n" . From 4f66320cc721f7562bad5594ade29dd0936b7bde Mon Sep 17 00:00:00 2001 From: Simon Lindsay Date: Fri, 1 Sep 2017 14:27:40 +0930 Subject: [PATCH 2/2] Missed a couple of things, and adding some newlines. --- src/Handler.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Handler.php b/src/Handler.php index 87c1b67..64745e3 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -138,7 +138,7 @@ public function createSettingsFile() "if (! is_dir(\$app_root . '/' . \$config_directories['sync'])) mkdir(\$app_root . '/' . \$config_directories['sync'], 0777, true);\n" . "\$settings['shepherd_site_id'] = getenv('SHEPHERD_SITE_ID');\n" . "\$settings['shepherd_url'] = getenv('SHEPHERD_URL');\n" . - "\$settings['shepherd_token'] = getenv('SHEPHERD_TOKEN_FILE') ? file_get_contents(getenv('SHEPHERD_TOKEN_FILE')) : getenv('SHEPHERD_TOKEN');\n" . + "\$settings['shepherd_token'] = getenv('SHEPHERD_TOKEN_FILE') ? file_get_contents(getenv('SHEPHERD_TOKEN_FILE')) : getenv('SHEPHERD_TOKEN');\n\n" . "if (getenv('REDIS_ENABLED')) {\n" . " \$settings['redis.connection']['interface'] = 'PhpRedis';\n" . " \$settings['redis.connection']['host'] = 'redis';\n" . @@ -148,11 +148,11 @@ public function createSettingsFile() " \$settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';\n" . " \$settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';\n" . " \$settings['cache']['bins']['config'] = 'cache.backend.chainedfast';\n\n" . - " // If we're not installing, include the redis services." . - " if (!isset($GLOBALS['install_state'])) {\n" . + " // If we're not installing, include the redis services.\n" . + " if (!isset(\$GLOBALS['install_state'])) {\n" . " \$settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';\n" . " }\n" . - "}\n" . + "}\n\n" . "/**\n * END SHEPHERD CONFIG\n */\n" . "\n" . "/**\n * START LOCAL CONFIG\n */\n" .