Skip to content

Commit

Permalink
chore(deposition): small refactors (#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored Feb 4, 2025
1 parent 98567eb commit 2b24ab1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ena-submission/src/ena_deposition/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class Config:


def secure_ena_connection(config: Config):
"""Modify passed-in config object"""
submit_to_ena_prod = config.submit_to_ena_prod
if submit_to_ena_prod and (config.backend_url not in config.allowed_submission_hosts):
logging.warn("WARNING: backend_url not in allowed_hosts")
logging.warning("WARNING: backend_url not in allowed_hosts")
submit_to_ena_prod = False
submit_to_ena_dev = not submit_to_ena_prod

Expand All @@ -55,19 +56,19 @@ def secure_ena_connection(config: Config):

if submit_to_ena_prod:
config.test = False
logging.warn("WARNING: Submitting to ENA production")
logging.warning("WARNING: Submitting to ENA production")
config.ena_submission_url = "https://www.ebi.ac.uk/ena/submit/drop-box/submit"
config.github_url = "https://pathoplexus.github.io/ena-submission/approved/approved_ena_submission_list.json"
config.ena_reports_service_url = "https://www.ebi.ac.uk/ena/submit/report"


def get_config(config_file: str):
with open("config/defaults.yaml") as f:
def get_config(config_file: str) -> Config:
with open("config/defaults.yaml", encoding="utf-8") as f:
defaults = yaml.safe_load(f)
with open(config_file, encoding="utf-8") as file:
full_config = yaml.safe_load(file)
for key, value in defaults.items():
if not key in full_config:
if key not in full_config:
full_config[key] = value
relevant_config = {key: full_config.get(key, []) for key in Config.__annotations__}
config = Config(**relevant_config)
Expand Down

0 comments on commit 2b24ab1

Please sign in to comment.