Coverage for opt/mealie/lib/python3.12/site-packages/mealie/scripts/healthcheck.py: 84%
17 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 03:04 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 03:04 +0000
1import os
2import sys
4import requests
7def main():
8 port = os.getenv("API_PORT")
10 if port is None: 10 ↛ 13line 10 didn't jump to line 13 because the condition on line 10 was always true
11 port = 9000
13 if all(os.getenv(x) for x in ["TLS_CERTIFICATE_PATH", "TLS_PRIVATE_KEY_PATH"]): 13 ↛ 14line 13 didn't jump to line 14 because the condition on line 13 was never true
14 proto = "https"
15 else:
16 proto = "http"
18 url = f"{proto}://127.0.0.1:{port}/api/app/about"
20 # TLS certificate is likely not issued for 127.0.0.1 so don't verify
21 r = requests.get(url, verify=False)
23 if r.status_code == 200:
24 sys.exit(0)
25 else:
26 sys.exit(1)
29if __name__ == "__main__": 29 ↛ exitline 29 didn't exit the module because the condition on line 29 was always true
30 main()