fix(health): Require Redis in production, optional in local
Redis health check now returns error status when not configured in production/staging environments, but remains optional in local dev. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,14 +138,16 @@ async function getDbHealth(): Promise<DbHealth> {
|
|||||||
|
|
||||||
async function getRedisHealth(): Promise<RedisHealth> {
|
async function getRedisHealth(): Promise<RedisHealth> {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
|
const isLocal = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'local' || !process.env.NODE_ENV;
|
||||||
|
|
||||||
// Check if Redis is configured
|
// Check if Redis is configured
|
||||||
if (!process.env.REDIS_URL && !process.env.REDIS_HOST) {
|
if (!process.env.REDIS_URL && !process.env.REDIS_HOST) {
|
||||||
|
// Redis is optional in local dev, required in prod/staging
|
||||||
return {
|
return {
|
||||||
status: 'ok', // Redis is optional
|
status: isLocal ? 'ok' : 'error',
|
||||||
connected: false,
|
connected: false,
|
||||||
latency_ms: 0,
|
latency_ms: 0,
|
||||||
error: 'Redis not configured',
|
error: isLocal ? 'Redis not configured (optional in local)' : 'Redis not configured (required in production)',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user