Refactored health checks
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -2,4 +2,4 @@
 | 
			
		||||
from .require_decorators import json_required
 | 
			
		||||
from .error_handlers import register_all_error_handlers
 | 
			
		||||
from .storage import storage
 | 
			
		||||
from .healthchecks import health_database_status
 | 
			
		||||
from .healthchecks import register_health_checks
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,7 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
from utils import storage
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
Healthchek functions
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
__author__ = "@tormakris"
 | 
			
		||||
__copyright__ = "Copyright 2020, Birbnetes Team"
 | 
			
		||||
__module_name__ = "healthchecks"
 | 
			
		||||
__version__text__ = "1"
 | 
			
		||||
from healthcheck import HealthCheck
 | 
			
		||||
from flask import Flask
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def health_database_status():
 | 
			
		||||
@@ -21,3 +13,9 @@ def health_database_status():
 | 
			
		||||
        output = str(e)
 | 
			
		||||
        is_database_working = False
 | 
			
		||||
    return is_database_working, output
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def register_health_checks(app: Flask):
 | 
			
		||||
    health = HealthCheck()
 | 
			
		||||
    health.add_check(health_database_status)
 | 
			
		||||
    app.add_url_rule("/healthz", "healthcheck", view_func=lambda: health.run())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user