Skip to content

Commit

Permalink
FS-4805 - Using fsd-utils healthcheck rather than custom implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrm500 committed Dec 11, 2024
1 parent 3ab0c9d commit 69c99e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 1 addition & 5 deletions app/blueprints/fund_builder/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
)


@build_fund_bp.route("/healthcheck")
def healthcheck():
return "OK", 200


@build_fund_bp.route("/")
@login_requested
def index():
Expand Down Expand Up @@ -328,6 +323,7 @@ def round(round_id=None):
error = error_formatter(params["form"].errors)
return render_template("round.html", **params, error=error)


def _convert_json_data_for_form(data) -> str:
if isinstance(data, dict):
return json.dumps(data)
Expand Down
9 changes: 6 additions & 3 deletions app/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from fsd_utils.authentication.decorators import SupportedApp
from fsd_utils.authentication.decorators import check_internal_user
from fsd_utils.authentication.decorators import login_required
from fsd_utils.healthchecks.checkers import FlaskRunningChecker
from fsd_utils.healthchecks.healthcheck import Healthcheck
from fsd_utils.logging import logging
from jinja2 import ChoiceLoader
from jinja2 import PackageLoader
Expand All @@ -17,7 +19,6 @@
from app.db.models import Fund # noqa:F401
from app.db.models import Round # noqa:F401


PUBLIC_ROUTES = [
"static",
"build_fund_bp.healthcheck",
Expand All @@ -31,8 +32,7 @@ def protect_private_routes(flask_app: Flask) -> Flask:
if endpoint in PUBLIC_ROUTES:
continue
flask_app.view_functions[endpoint] = login_required(
check_internal_user(view_func),
return_app=SupportedApp.FUND_APPLICATION_BUILDER
check_internal_user(view_func), return_app=SupportedApp.FUND_APPLICATION_BUILDER
)
return flask_app

Expand Down Expand Up @@ -91,6 +91,9 @@ def create_app() -> Flask:
def forbidden_error(error):
return render_template("403.html"), 403

health = Healthcheck(flask_app)
health.add_check(FlaskRunningChecker())

return flask_app


Expand Down

0 comments on commit 69c99e0

Please sign in to comment.