From ca7d9ae7f6d28eb95ae3887f2c4f398174c61bb7 Mon Sep 17 00:00:00 2001 From: pgarrett Date: Wed, 24 Jan 2024 13:23:54 -0800 Subject: [PATCH] env for base_url --- constants.py | 2 ++ util.py | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/constants.py b/constants.py index 970b101..2676297 100644 --- a/constants.py +++ b/constants.py @@ -80,3 +80,5 @@ def get_env_str(var_name, default): VALID_PROTEASES = copy.deepcopy(PROTEASES) VALID_PROTEASES.pop('non-specific', None) VALID_PROTEASES = {k.replace(' ', '_'): v for k, v in VALID_PROTEASES.items()} + +BASE_URL = get_env_str('BASE_URL', 'http://localhost:8501') diff --git a/util.py b/util.py index df9a431..c3215a0 100644 --- a/util.py +++ b/util.py @@ -14,7 +14,7 @@ import matplotlib as mpl from peptacular.term.modification import add_n_term_modification, add_c_term_modification -from constants import LINK +from constants import LINK, BASE_URL def fetch_sequence_from_uniprot(accession_number): @@ -198,7 +198,6 @@ def generate_app_url(protein_id, protein_sequence, proteases, custom_regex, miss min_charge, max_charge, min_mz, max_mz, remove_non_proteotypic, n_term_static_mod, c_term_static_mod, num_static_mods, n_term_var_mod, c_term_var_mod, max_var_mods, num_variable_mods, static_mods, variable_mods): - base_url = 'http://localhost:8501/' # flip the dictionary static_mods_rev = {} @@ -240,7 +239,7 @@ def generate_app_url(protein_id, protein_sequence, proteases, custom_regex, miss 'variable_mods': variable_mod_str } query_string = '&'.join([f'{key}={value}' for key, value in params.items() if value is not None]) - return f'{base_url}?{query_string}' + return f'{BASE_URL}?{query_string}' def make_clickable(sequence, mass_type):