From dcb00616747bfd18783e34c21976efa51f6986c5 Mon Sep 17 00:00:00 2001 From: ZHU Yuhui Date: Sat, 14 Sep 2024 11:47:03 +0200 Subject: [PATCH 1/3] load config.yaml from mounted config volume --- src/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index 51b84f95..78e8893b 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -19,7 +19,7 @@ ENV_CONFIG_FILE_PATH_KEY = "ENV_CONFIG_FILE_PATH" DEFAULT_LOGGER_LEVEL = "info" DEFAULT_LOG_FILE_NAME = "icloud.log" -DEFAULT_CONFIG_FILE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), DEFAULT_CONFIG_FILE_NAME) +DEFAULT_CONFIG_FILE_PATH = os.path.join('/config', DEFAULT_CONFIG_FILE_NAME) DEFAULT_COOKIE_DIRECTORY = "/config/session_data" warnings.filterwarnings("ignore", category=DeprecationWarning) From af179c5100a5bbac7f165abd6b0ed25cd927183f Mon Sep 17 00:00:00 2001 From: ZHU Yuhui Date: Sat, 14 Sep 2024 14:21:33 +0200 Subject: [PATCH 2/3] get_logger() read config from ENV_CONFIG_FILE_PATH --- src/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index 78e8893b..d201c290 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -98,7 +98,7 @@ def format(self, record): def get_logger(): """Return logger.""" logger = logging.getLogger() - logger_config = get_logger_config(config=read_config()) + logger_config = get_logger_config(config=read_config(config_path=os.environ.get(ENV_CONFIG_FILE_PATH_KEY, DEFAULT_CONFIG_FILE_PATH))) if logger_config: level_name = logging.getLevelName(level=logger_config["level"].upper()) logger.setLevel(level=level_name) From f651bc67e8249e1051404f0c51141d530ab85cec Mon Sep 17 00:00:00 2001 From: ZHU Yuhui Date: Sat, 14 Sep 2024 14:27:28 +0200 Subject: [PATCH 3/3] revert --- src/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__init__.py b/src/__init__.py index d201c290..cb8601d8 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -19,7 +19,7 @@ ENV_CONFIG_FILE_PATH_KEY = "ENV_CONFIG_FILE_PATH" DEFAULT_LOGGER_LEVEL = "info" DEFAULT_LOG_FILE_NAME = "icloud.log" -DEFAULT_CONFIG_FILE_PATH = os.path.join('/config', DEFAULT_CONFIG_FILE_NAME) +DEFAULT_CONFIG_FILE_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), DEFAULT_CONFIG_FILE_NAME) DEFAULT_COOKIE_DIRECTORY = "/config/session_data" warnings.filterwarnings("ignore", category=DeprecationWarning)