Skip to content

Commit

Permalink
Use an environment variable to decide whether to show debugging infor…
Browse files Browse the repository at this point in the history
…mation.
  • Loading branch information
agarny committed Dec 14, 2022
1 parent 3219e04 commit 94fb198
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Config(object):
BIOLUCIDA_PASSWORD = os.environ.get("BIOLUCIDA_PASSWORD", "local-password")
KNOWLEDGEBASE_KEY = os.environ.get("KNOWLEDGEBASE_KEY", "secret-key")
DEPLOY_ENV = os.environ.get("DEPLOY_ENV", "development")
SPARC_API_DEBUGGING = os.environ.get("SPARC_API_DEBUGGING", "ON")
SPARC_APP_HOST = os.environ.get("SPARC_APP_HOST", "https://sparc-app.herokuapp.com")
SCI_CRUNCH_HOST = os.environ.get("SCICRUNCH_HOST", "https://scicrunch.org/api/1/elastic/SPARC_PortalDatasets_pr")
MAPSTATE_TABLENAME = os.environ.get("MAPSTATE_TABLENAME", "mapstates")
Expand Down
12 changes: 6 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def inject_markdown(resp):
resp["markdown"] = mark_req.text


def inject_template_data(resp, debug):
def inject_template_data(resp):
id_ = resp.get("id")
version = resp.get("version")
if id_ is None or version is None:
Expand All @@ -644,6 +644,7 @@ def inject_template_data(resp, debug):
)
except ClientError:
# If the file is not under folder 'files', check under folder 'packages'
debug = Config.SPARC_API_DEBUGGING == "ON"
if debug:
logging.warning(
"Required file template.json was not found under /files folder, trying under /packages..."
Expand Down Expand Up @@ -688,14 +689,13 @@ def build_filetypes_table(osparc_viewers):


@app.route("/sim/dataset/<id_>")
@app.route("/sim/dataset/<id_>/<debug_>")
def sim_dataset(id_, debug_="debug"):
def sim_dataset(id_):
if request.method == "GET":
req = requests.get("{}/datasets/{}".format(Config.DISCOVER_API_HOST, id_))
if req.ok:
json_data = req.json()
inject_markdown(json_data)
inject_template_data(json_data, debug_ == "debug")
inject_template_data(json_data)
return jsonify(json_data)
abort(404, description="Resource not found")

Expand Down Expand Up @@ -898,10 +898,10 @@ def create_wrike_task():
if form and 'title' in form and 'description' in form:
title = form["title"]
description = form["description"]

## Updated Wrike Space info based off type of task. We default to drc_feedback folder if type is not present.
url = 'https://www.wrike.com/api/v4/folders/' + Config.DRC_FEEDBACK_FOLDER_ID + '/tasks'
followers = [Config.CCB_HEAD_WRIKE_ID, Config.DAT_CORE_TECH_LEAD_WRIKE_ID, Config.MAP_CORE_TECH_LEAD_WRIKE_ID, Config.K_CORE_TECH_LEAD_WRIKE_ID, Config.SIM_CORE_TECH_LEAD_WRIKE_ID, Config.MODERATOR_WRIKE_ID]
followers = [Config.CCB_HEAD_WRIKE_ID, Config.DAT_CORE_TECH_LEAD_WRIKE_ID, Config.MAP_CORE_TECH_LEAD_WRIKE_ID, Config.K_CORE_TECH_LEAD_WRIKE_ID, Config.SIM_CORE_TECH_LEAD_WRIKE_ID, Config.MODERATOR_WRIKE_ID]
responsibles = [Config.CCB_HEAD_WRIKE_ID, Config.DAT_CORE_TECH_LEAD_WRIKE_ID, Config.MAP_CORE_TECH_LEAD_WRIKE_ID, Config.K_CORE_TECH_LEAD_WRIKE_ID, Config.SIM_CORE_TECH_LEAD_WRIKE_ID, Config.MODERATOR_WRIKE_ID]
customStatus = Config.DRC_WRIKE_CUSTOM_STATUS_ID
taskType = ""
Expand Down

0 comments on commit 94fb198

Please sign in to comment.