Skip to content

Commit 1b8604c

Browse files
Merge pull request #32 from gnanarepo/master
Master into Develop
2 parents 45b1f98 + abac9ab commit 1b8604c

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

aviso_core/middlewares.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ def __init__(self, get_response):
1616
self.get_response = get_response
1717

1818
def __call__(self, request):
19+
if request.path.rstrip("/") == "/gbm/health":
20+
return self.get_response(request)
21+
1922
# ===========================================================
2023
# 1. REQUEST PHASE: Initialize Context
2124
# ===========================================================

aviso_core/settings.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@
2525

2626
DEBUG = os.environ.get('DEBUG', 'True') == 'True'
2727
# --- LOGIC FOR ALLOWED HOSTS ---
28-
if DEBUG:
29-
# Local development
30-
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0']
31-
CSRF_TRUSTED_ORIGINS = ["http://localhost:8000", "http://127.0.0.1:8000"]
32-
else:
33-
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
34-
trusted_origins = os.environ.get('TRUSTED_ORIGINS', '').split(',')
35-
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in trusted_origins if origin.strip()]
3628

37-
# Application definition
29+
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
30+
trusted_origins = os.environ.get('TRUSTED_ORIGINS', '').split(',')
31+
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in trusted_origins if origin.strip()]
3832

3933
INSTALLED_APPS = [
4034
'django.contrib.admin',
@@ -89,6 +83,26 @@
8983
}
9084

9185

86+
# if DEBUG:
87+
# DATABASES = {
88+
# "default": {
89+
# "ENGINE": "django.db.backends.sqlite3",
90+
# "NAME": BASE_DIR / "db.sqlite3",
91+
# }
92+
# }
93+
# else:
94+
# DATABASES = {
95+
# "default": {
96+
# "ENGINE": "django.db.backends.postgresql",
97+
# "NAME": os.environ.get("DB_NAME"),
98+
# "USER": os.environ.get("DB_USER"),
99+
# "PASSWORD": os.environ.get("DB_PASSWORD"),
100+
# "HOST": os.environ.get("DB_HOST"),
101+
# "PORT": os.environ.get("DB_PORT", "5432"),
102+
# }
103+
# }
104+
105+
92106
# Password validation
93107
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
94108

gbm_apis/api/health.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from django.views import View
44
from django.utils.decorators import method_decorator
55
from django.views.decorators.csrf import csrf_exempt
6-
from django.db import connection
6+
# from django.db import connection
77
from django.conf import settings
88

99
logger = logging.getLogger(f'gnana.{__name__}')
@@ -26,8 +26,8 @@ def get(self, request):
2626

2727
try:
2828
## TODO Mongo HEalth CHeck
29-
with connection.cursor() as cursor:
30-
cursor.execute("SELECT 1")
29+
# with connection.cursor() as cursor:
30+
# cursor.execute("SELECT 1")
3131
health_status["checks"]["database"] = "ok"
3232
except Exception as db_error:
3333
logger.warning(f"Database health check failed: {str(db_error)}")

0 commit comments

Comments
 (0)