Skip to content

Commit d4193f0

Browse files
committed
fix: correct health check for user-provided API keys
- Environment validation no longer requires server-side API keys - System is healthy when log directory is writable - API connectivity only checked when keys are actually present - Fixes Railway deployment showing incorrect 'unhealthy' status This allows Railway app to be healthy without server-side environment variables since users provide API keys through the web interface.
1 parent c034f8d commit d4193f0

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/health.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,9 @@ def validate_environment(self) -> EnvironmentStatus:
8989
results["log_directory"] = "readonly"
9090

9191
# Determine overall validity
92-
is_valid = all(
93-
status in ["present", "writable"]
94-
for status in [
95-
results["intercom_token"],
96-
results["openai_key"],
97-
results["log_directory"],
98-
]
99-
)
92+
# For Railway/production deployment, API keys are optional (user-provided via UI)
93+
# Only require log directory to be writable for system health
94+
is_valid = results["log_directory"] == "writable"
10095

10196
status = EnvironmentStatus(valid=is_valid, **results)
10297

@@ -335,8 +330,12 @@ async def get_health_status(self) -> HealthStatus:
335330
if not env_status.valid:
336331
overall_status = "unhealthy"
337332
elif (
338-
connectivity_status.intercom_api != "reachable"
339-
or connectivity_status.openai_api != "reachable"
333+
# Only check connectivity if API keys are actually present
334+
env_status.intercom_token == "present"
335+
and connectivity_status.intercom_api != "reachable"
336+
) or (
337+
env_status.openai_key == "present"
338+
and connectivity_status.openai_api != "reachable"
340339
):
341340
overall_status = "degraded"
342341
else:

0 commit comments

Comments
 (0)