debug: Add extended Docker Secrets debugging

- Check getenv(), $_ENV and $_SERVER for REDIS_PASSWORD_FILE
- Check if /run/secrets/redis_password file exists
- Help diagnose why REDIS_PASSWORD_FILE is not in environment
This commit is contained in:
2025-11-02 22:25:13 +01:00
parent 14900940c5
commit 64400a317b

View File

@@ -62,16 +62,26 @@ final readonly class AppBootstrapper
error_log("REDIS_PASSWORD resolved: " . ($env->has('REDIS_PASSWORD') ? 'YES' : 'NO')); error_log("REDIS_PASSWORD resolved: " . ($env->has('REDIS_PASSWORD') ? 'YES' : 'NO'));
error_log("REDIS_PASSWORD value: " . (empty($env->get('REDIS_PASSWORD')) ? 'EMPTY' : 'SET')); error_log("REDIS_PASSWORD value: " . (empty($env->get('REDIS_PASSWORD')) ? 'EMPTY' : 'SET'));
// Check if file exists // Check system environment directly
$redisPasswordFile = $env->get('REDIS_PASSWORD_FILE'); error_log("------ SYSTEM ENVIRONMENT CHECK ------");
if ($redisPasswordFile && is_string($redisPasswordFile)) { error_log("getenv('REDIS_PASSWORD_FILE'): " . (getenv('REDIS_PASSWORD_FILE') !== false ? getenv('REDIS_PASSWORD_FILE') : 'NOT SET'));
error_log("REDIS_PASSWORD_FILE path: $redisPasswordFile"); error_log("isset(\$_ENV['REDIS_PASSWORD_FILE']): " . (isset($_ENV['REDIS_PASSWORD_FILE']) ? 'YES' : 'NO'));
error_log("File exists: " . (file_exists($redisPasswordFile) ? 'YES' : 'NO')); if (isset($_ENV['REDIS_PASSWORD_FILE'])) {
error_log("File readable: " . (is_readable($redisPasswordFile) ? 'YES' : 'NO')); error_log("\$_ENV['REDIS_PASSWORD_FILE']: " . $_ENV['REDIS_PASSWORD_FILE']);
if (file_exists($redisPasswordFile) && is_readable($redisPasswordFile)) {
$content = file_get_contents($redisPasswordFile);
error_log("File content length: " . strlen($content ?? ''));
} }
error_log("isset(\$_SERVER['REDIS_PASSWORD_FILE']): " . (isset($_SERVER['REDIS_PASSWORD_FILE']) ? 'YES' : 'NO'));
if (isset($_SERVER['REDIS_PASSWORD_FILE'])) {
error_log("\$_SERVER['REDIS_PASSWORD_FILE']: " . $_SERVER['REDIS_PASSWORD_FILE']);
}
// Check if file exists at expected location
$expectedFile = '/run/secrets/redis_password';
error_log("Expected file path: $expectedFile");
error_log("File exists: " . (file_exists($expectedFile) ? 'YES' : 'NO'));
error_log("File readable: " . (is_readable($expectedFile) ? 'YES' : 'NO'));
if (file_exists($expectedFile) && is_readable($expectedFile)) {
$content = file_get_contents($expectedFile);
error_log("File content length: " . strlen($content ?? ''));
} }
error_log("------------------------------------"); error_log("------------------------------------");