fix(redis): harden TLS tests and surface TLS config at startup

Isolate Redis TLS unit tests from parent-process env vars and log
REDIS_USE_TLS settings at boot so misconfiguration is easier to spot.
This commit is contained in:
wizardchen
2026-07-06 23:03:25 +08:00
committed by lyingbug
parent d5b8d2f886
commit 4f2dca0b63
3 changed files with 18 additions and 1 deletions
+6
View File
@@ -89,6 +89,8 @@ var startupEnvVars = []envVarSpec{
// Cache / queue
{name: "REDIS_ADDR"},
{name: "REDIS_PASSWORD", sensitive: true},
{name: "REDIS_USE_TLS"},
{name: "REDIS_TLS_SERVER_NAME"},
// Object storage
{name: "STORAGE_TYPE"},
{name: "MINIO_ENDPOINT"},
@@ -137,6 +139,10 @@ func LogStartupEnv(ctx context.Context) {
"[startup-env] SYSTEM_AES_KEY is set but %d bytes long; AES-256 requires exactly 32 bytes — encryption is DISABLED",
len(k))
}
if strings.EqualFold(strings.TrimSpace(os.Getenv("REDIS_TLS_INSECURE_SKIP_VERIFY")), "true") {
logger.Warn(ctx,
"[startup-env] REDIS_TLS_INSECURE_SKIP_VERIFY=true — Redis TLS certificate verification is DISABLED; do not use in production")
}
}
func formatEnvValue(s envVarSpec, val string) string {