From 787a03db4f0a2447983f42fe7fc0a0f13901f30f Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Sun, 28 Nov 2021 17:25:09 +0300 Subject: [PATCH] Took out env vars reading from utils to config --- config.py | 4 +++- utils.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index c53bba3..0cc8ce3 100644 --- a/config.py +++ b/config.py @@ -14,4 +14,6 @@ model_cache_db_path = os.getenv('CACHE_PATH', 'squads_stat_cache.sqlite3') sqlite_db_path = os.getenv('SQLITE_DB_PATH', 'squads_stat.sqlite3') -log_level = os.getenv('LOG_LEVEL', 'DEBUG').upper() \ No newline at end of file +log_level = os.getenv('LOG_LEVEL', 'DEBUG').upper() + +time_between_requests = os.getenv("TIME_BETWEEN_REQUESTS") diff --git a/utils.py b/utils.py index a14cf29..ece1304 100644 --- a/utils.py +++ b/utils.py @@ -5,15 +5,15 @@ import enum import falcon import requests - +import config from EDMCLogging import get_main_logger logger = get_main_logger() TIME_BETWEEN_REQUESTS: float = 3.0 -if os.getenv("JUBILANT_TIME_BETWEEN_REQUESTS") is not None: +if config.time_between_requests is not None: try: - TIME_BETWEEN_REQUESTS = float(os.getenv("JUBILANT_TIME_BETWEEN_REQUESTS")) + TIME_BETWEEN_REQUESTS = float(config.time_between_requests) except TypeError: # env doesn't contain a float pass