Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add simple wsgi health check
Artur Smętd093cfb4e30b
diff --git a/saleor/wsgi/__init__.py b/saleor/wsgi/__init__.pyindex 8dbb525aac..3d04e8426d 100644--- a/saleor/wsgi/__init__.py+++ b/saleor/wsgi/__init__.py@@ -14,7 +14,6 @@ framework."""import os-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'saleor.settings')# This application object is used by any WSGI server configured to use this@@ -26,3 +25,6 @@ application = get_wsgi_application()# Apply WSGI middleware here.# from helloworld.wsgi import HelloWorldApplication# application = HelloWorldApplication(application)+from .health_check import health_check++application = health_check(application, '/health/')diff --git a/saleor/wsgi/health_check.py b/saleor/wsgi/health_check.pynew file mode 100644index 0000000000..85b11eb259--- /dev/null+++ b/saleor/wsgi/health_check.py@@ -0,0 +1,8 @@++def health_check(application, health_url):+ def health_check_wrapper(environ, start_response):+ if environ.get('PATH_INFO') == health_url:+ start_response('200 OK', [('Content-Type', 'text/plain')])+ return []+ return application(environ, start_response)+ return health_check_wrapper