From b6ca91153f2e6635e2cf830094018fe75c54f7a1 Mon Sep 17 00:00:00 2001 From: VivianDee <115420678+VivianDee@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:29:47 +0100 Subject: [PATCH 1/5] Update routes.py --- app/api/routes/routes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 2804012..364cf74 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -1,4 +1,3 @@ -from sqlite3 import DatabaseError from app.api.integrations.events_service import EventServiceIntegration from flask import Blueprint, request, jsonify, send_from_directory from app.api.services import ( -- 2.34.1 From ce6b0684c8dc2e2199980bffc458a26dba0347d1 Mon Sep 17 00:00:00 2001 From: VivianDee <115420678+VivianDee@users.noreply.github.com> Date: Fri, 10 Oct 2025 16:15:41 +0100 Subject: [PATCH 2/5] [add]: DB_URI --- app/api/routes/routes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 364cf74..38b1052 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -23,6 +23,7 @@ from flask_jwt_extended import ( from sqlalchemy import text from app.extensions import db from app.config import settings +from urllib.parse import urlparse api = Blueprint("api", __name__) @@ -128,6 +129,14 @@ def health_check(): errors = [] status = "ok" + # Extract the database URI + try: + db_uri = db.engine.url.render_as_string(hide_password=False) + db_uri = db_uri + except Exception as e: + db_uri = "Unavailable" + + # Check database connection try: db.session.execute(text("SELECT 1")) @@ -156,6 +165,7 @@ def health_check(): response = { "status": status, "db_status": db_status, + "db_uri": db_uri, "events_service_status": events_service_status, "errors": errors or None } -- 2.34.1 From 6377158c3ce4dc7e58295695f9fb9d78ae443f69 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 9 Oct 2025 16:00:57 -0400 Subject: [PATCH 3/5] Try catch at start --- app/__init__.py | 50 ++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 84ef02b..deb9ed6 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -20,40 +20,44 @@ from flask_jwt_extended import ( def create_app(): """Factory function to create a Flask app instance""" # import oracledb - + # oracledb.init_oracle_client(lib_dir=None) - app = Flask(__name__) + try: - # Load configuration - app.config.from_object(Config) + app = Flask(__name__) - CORS(app) + # Load configuration + app.config.from_object(Config) - JWTManager(app) - CORS(app, supports_credentials=True) + CORS(app) - # Swagger Doc - SWAGGER_URL = app.config.get("SWAGGER_URL") - API_URL = app.config.get("API_URL") + JWTManager(app) + CORS(app, supports_credentials=True) - # Register blueprints - app.register_blueprint(api) + # Swagger Doc + SWAGGER_URL = app.config.get("SWAGGER_URL") + API_URL = app.config.get("API_URL") - swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL) - app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL) + # Register blueprints + app.register_blueprint(api) - # Error Handlers - register_error_handlers(app) + swagger_ui_blueprint = get_swaggerui_blueprint(SWAGGER_URL, API_URL) + app.register_blueprint(swagger_ui_blueprint, url_prefix=SWAGGER_URL) - from . import models + # Error Handlers + register_error_handlers(app) - # Initialize Flask-Mail - mail.init_app(app) + from . import models - # Database and Migrations - db.init_app(app) + # Initialize Flask-Mail + mail.init_app(app) - migrate.init_app(app, db) + # Database and Migrations + db.init_app(app) - return app + migrate.init_app(app, db) + + return app + except Exception as e: + print(f"An unexpected error occurred: {e}") -- 2.34.1 From 50eaf0099bace989cfe129d60160cd25d62be3de Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 9 Oct 2025 16:14:30 -0400 Subject: [PATCH 4/5] rem remove swagger file path --- app/api/routes/routes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index 38b1052..c1cb069 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -42,10 +42,10 @@ def swagger_json(): return send_from_directory(swagger_dir, "digifi_swagger.json") -@api.route("/swagger/") -def serve_paths(filename): - swagger_dir = os.path.join("swagger") - return send_from_directory(swagger_dir, filename) +# @api.route("/swagger/") +# def serve_paths(filename): +# swagger_dir = os.path.join("swagger") +# return send_from_directory(swagger_dir, filename) # EligibilityCheck Endpoint -- 2.34.1 From dd0f39428ab9aa211b3c1bef7482e2556f874c4b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 9 Oct 2025 19:17:57 -0400 Subject: [PATCH 5/5] SQLALCHEMY_DATABASE_URI --- app/api/routes/routes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/routes/routes.py b/app/api/routes/routes.py index c1cb069..55584d9 100644 --- a/app/api/routes/routes.py +++ b/app/api/routes/routes.py @@ -122,7 +122,7 @@ def notification_callback(): # Health Check Endpoint @api.route("/health", methods=["GET"]) def health_check(): - + SQLALCHEMY_DATABASE_URI = settings.SQLALCHEMY_DATABASE_URI response = {} db_status = "Connection Successful" events_service_status = "Connection Successful" @@ -139,6 +139,7 @@ def health_check(): # Check database connection try: + logger.info(f"Database Health == : {SQLALCHEMY_DATABASE_URI}") db.session.execute(text("SELECT 1")) except Exception as e: db_status = "Connection Failed" -- 2.34.1