diff --git a/scripts/jyotish_api_server.py b/scripts/jyotish_api_server.py index 10b54cc0..1de69498 100644 --- a/scripts/jyotish_api_server.py +++ b/scripts/jyotish_api_server.py @@ -1450,6 +1450,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler): endpoint = os.environ.get('VEDASTRO_API_ENDPOINT', '').strip() network_flag = os.environ.get('VEDASTRO_ENABLE_NETWORK', '').strip().lower() network_enabled = network_flag in {'1', 'true', 'yes'} + has_api_key = bool(os.environ.get('VEDASTRO_API_KEY', '').strip()) parsed = urlparse(endpoint) if endpoint else None configured = bool(endpoint) if not configured: @@ -1474,6 +1475,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler): 'status': status, 'configured': configured, 'network_enabled': network_enabled, + 'has_api_key': has_api_key, 'endpoint_host': parsed.netloc if parsed else None, 'required_env': { 'endpoint': 'VEDASTRO_API_ENDPOINT', @@ -1538,6 +1540,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler): 'ayanamsa_default': 'lahiri', 'modules': 'Chart/KP/Synastry/Prashna/Remedies/Dasha/Varga/Jaimini/Ashtakavarga/Shadbala/Yoga/Aspects/Tajika/Muhurta/BhavaChalit/BhavaBala/Sudarshana/Nakshatra/Transit/RectificationGate/CaseValidation/DivisionalYoga/Kakshya', 'async_job_runtime': async_job_runtime_status(), + 'vedastro': self._vedastro_status(), }) elif path == '/api/cities': self._json(list(CITY_DB.keys())) diff --git a/tests/test_api_server_security.py b/tests/test_api_server_security.py index 8b67dad0..0a5b4913 100644 --- a/tests/test_api_server_security.py +++ b/tests/test_api_server_security.py @@ -215,6 +215,10 @@ def test_health_endpoint_exposes_runtime_accuracy_metadata() -> None: assert payload['ayanamsa_default'] == 'lahiri' assert 'swisseph_available' in payload assert 'swisseph_version' in payload + assert payload['vedastro']['configured'] is False + assert payload['vedastro']['network_enabled'] is False + assert payload['vedastro']['has_api_key'] is False + assert 'VEDASTRO_API_KEY=' not in json.dumps(payload['vedastro']) def test_vedastro_status_endpoint_exposes_safe_adapter_state(monkeypatch) -> None: