From 9ce12922aa2c86a3ab6843bc45b94197e7b18637 Mon Sep 17 00:00:00 2001 From: Pavol Caban Date: Thu, 22 Oct 2026 10:45:25 +0200 Subject: [PATCH] fix(starter): Redis drop-in fatal when REDIS_PORT is unset Define WP_REDIS_HOST/PORT only when set (port as int), so the drop-in's 127.0.0.1:6379 defaults apply. Enable selective flush by default for shared Redis dbs; WP_REDIS_SELECTIVE_FLUSH=false opts out. Claude-Session: https://claude.ai/code/session_01N2CKAdb8iZMn5mbymAy6Bc --- packages/webentor-starter/config/application.php | 11 +++++++++-- test-site/config/application.php | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/webentor-starter/config/application.php b/packages/webentor-starter/config/application.php index 4b94999..39f5e05 100644 --- a/packages/webentor-starter/config/application.php +++ b/packages/webentor-starter/config/application.php @@ -148,9 +148,16 @@ /** * REDIS CLIENT */ -Config::define('WP_REDIS_HOST', env('REDIS_HOST') ?? ''); -Config::define('WP_REDIS_PORT', env('REDIS_PORT') ?? ''); +// Only override when set: empty strings beat the drop-in's 127.0.0.1:6379 defaults, and phpredis needs an int port +if (env('REDIS_HOST')) { + Config::define('WP_REDIS_HOST', env('REDIS_HOST')); +} +if (env('REDIS_PORT')) { + Config::define('WP_REDIS_PORT', (int) env('REDIS_PORT')); +} Config::define('WP_REDIS_DISABLED', env('WP_REDIS_DISABLED')); +// Default on: sites often share one Redis db, where a full flush would wipe every site's cache +Config::define('WP_REDIS_SELECTIVE_FLUSH', env('WP_REDIS_SELECTIVE_FLUSH') ?? true); /** * Define SENTRY vars. diff --git a/test-site/config/application.php b/test-site/config/application.php index 4b94999..39f5e05 100644 --- a/test-site/config/application.php +++ b/test-site/config/application.php @@ -148,9 +148,16 @@ /** * REDIS CLIENT */ -Config::define('WP_REDIS_HOST', env('REDIS_HOST') ?? ''); -Config::define('WP_REDIS_PORT', env('REDIS_PORT') ?? ''); +// Only override when set: empty strings beat the drop-in's 127.0.0.1:6379 defaults, and phpredis needs an int port +if (env('REDIS_HOST')) { + Config::define('WP_REDIS_HOST', env('REDIS_HOST')); +} +if (env('REDIS_PORT')) { + Config::define('WP_REDIS_PORT', (int) env('REDIS_PORT')); +} Config::define('WP_REDIS_DISABLED', env('WP_REDIS_DISABLED')); +// Default on: sites often share one Redis db, where a full flush would wipe every site's cache +Config::define('WP_REDIS_SELECTIVE_FLUSH', env('WP_REDIS_SELECTIVE_FLUSH') ?? true); /** * Define SENTRY vars.