Coverage for opt/mealie/lib/python3.12/site-packages/mealie/scripts/healthcheck.py: 76%
17 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:32 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-11-25 15:32 +0000
1import os 1abcdefghijkl
2import sys 1abcdefghijkl
4import requests 1abcdefghijkl
7def main(): 1abcdefghijkl
8 port = os.getenv("API_PORT") 1abcdefghijkl
10 if port is None: 10 ↛ 13line 10 didn't jump to line 13 because the condition on line 10 was always true1abcdefghijkl
11 port = 9000 1abcdefghijkl
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 true1abcdefghijkl
14 proto = "https"
15 else:
16 proto = "http" 1abcdefghijkl
18 url = f"{proto}://127.0.0.1:{port}/api/app/about" 1abcdefghijkl
20 # TLS certificate is likely not issued for 127.0.0.1 so don't verify
21 r = requests.get(url, verify=False) 1abcdefghijkl
23 if r.status_code == 200: 23 ↛ 26line 23 didn't jump to line 26 because the condition on line 23 was always true1abcdefghijkl
24 sys.exit(0) 1abcdefghijkl
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 true1abcdefghijkl
30 main() 1abcdefghijkl