Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions application/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

basedir = os.path.abspath(os.path.dirname(__file__))
ENABLE_MYOPENCRE = os.getenv("ENABLE_MYOPENCRE", "false").lower() == "true"


class Config:
Expand Down
11 changes: 11 additions & 0 deletions application/web/web_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from application.cmd import cre_main
from application.defs import cre_defs as defs
from application.defs import cre_exceptions
from application.config import ENABLE_MYOPENCRE

from application.utils import spreadsheet as sheet_utils
from application.utils import mdutils, redirectors, gap_analysis
Expand Down Expand Up @@ -825,8 +826,15 @@ def all_cres() -> Any:
# Importing Handlers


@app.route("/api/capabilities")
def capabilities():
return jsonify({"myopencre": ENABLE_MYOPENCRE})


@app.route("/rest/v1/cre_csv", methods=["GET"])
def get_cre_csv() -> Any:
if not ENABLE_MYOPENCRE:
abort(404)
if posthog:
posthog.capture(f"get_cre_csv", "")

Expand Down Expand Up @@ -854,6 +862,9 @@ def get_cre_csv() -> Any:

@app.route("/rest/v1/cre_csv_import", methods=["POST"])
def import_from_cre_csv() -> Any:
if not ENABLE_MYOPENCRE:
abort(404)

if not os.environ.get("CRE_ALLOW_IMPORT"):
abort(
403,
Expand Down