mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 10:37:11 -04:00 
			
		
		
		
	* fix(ml): Resolve IPv6 startup crash and healthcheck failure Fixes #13782 * fix(ml): updated the fix to use the std lib * Apply code formatting to __main__.py
		
			
				
	
	
		
			20 lines
		
	
	
		
			463 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			463 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import os
 | |
| import sys
 | |
| from ipaddress import ip_address
 | |
| 
 | |
| import requests
 | |
| 
 | |
| port = os.getenv("IMMICH_PORT", 3003)
 | |
| host = os.getenv("IMMICH_HOST", "0.0.0.0")
 | |
| 
 | |
| host = "localhost" if host == "0.0.0.0" else host
 | |
| host = f"[{host}]" if ip_address(host).version == 6 else host
 | |
| 
 | |
| try:
 | |
|     response = requests.get(f"http://{host}:{port}/ping", timeout=2)
 | |
|     if response.status_code == 200:
 | |
|         sys.exit(0)
 | |
|     sys.exit(1)
 | |
| except requests.RequestException:
 | |
|     sys.exit(1)
 |