fix: Add workaround for REDIS_PASSWORD_FILE not being set by Docker Compose

- Manually set REDIS_PASSWORD_FILE if file exists but variable is not set
- Handles cases where Docker Compose doesn't set the variable correctly
- Should fix issue where REDIS_PASSWORD_FILE is missing even though configured
This commit is contained in:
2025-11-02 22:48:10 +01:00
parent 73de91c2d3
commit 0c4ff1283c

View File

@@ -50,6 +50,14 @@ final readonly class AppBootstrapper
// Initialize environment with encryption support // Initialize environment with encryption support
$env = $this->initializeEnvironment(); $env = $this->initializeEnvironment();
// Workaround: If REDIS_PASSWORD_FILE is not set but expected file exists, set it manually
// This handles cases where Docker Compose doesn't set the variable correctly
$expectedRedisPasswordFile = '/run/secrets/redis_password';
if (!$env->has('REDIS_PASSWORD_FILE') && file_exists($expectedRedisPasswordFile)) {
// Add REDIS_PASSWORD_FILE to environment if file exists
$env = $env->withVariable('REDIS_PASSWORD_FILE', $expectedRedisPasswordFile);
}
error_log("------ ENVIRONMENT VARIABLES ------"); error_log("------ ENVIRONMENT VARIABLES ------");
error_log(print_r($env->all(true), true)); error_log(print_r($env->all(true), true));