From 202a3eb383ccad29d1597d4a5f6dc62d75c790b8 Mon Sep 17 00:00:00 2001 From: Anry Das Date: Sat, 11 Oct 2025 16:54:58 +0300 Subject: [PATCH] Improved app_config.get_config_value - added ability to get hierarchical YAML configs --- app_config.py | 8 +++++++- main.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app_config.py b/app_config.py index e307527..c5e32c5 100644 --- a/app_config.py +++ b/app_config.py @@ -31,7 +31,13 @@ def read_app_config(): return j def get_config_value(cfg, section, key, default): - return cfg[section][key] if section in cfg and key in cfg[section] else default + if '.' in section: + s = section.split('.', 1) + new_section = s[1] + new_cfg = cfg[s[0]] + return get_config_value(new_cfg, new_section, key, default) + else: + return cfg[section][key] if section in cfg and key in cfg[section] else default def parse_config(cfg): global UPLOAD_DIR, APP_PORT, IS_DEBUG, DB_URL, ALIAS_NUM_LETTERS, ALIAS_NUM_DIGITS\ diff --git a/main.py b/main.py index 6315f9f..a022b3e 100644 --- a/main.py +++ b/main.py @@ -385,7 +385,7 @@ async def download_file( async def download_link( file_id: str ): - """Download a file by LINK (without API key)""" + """Download a file by DIRECT LINK (without API key)""" async with db_pool.acquire() as conn: # Get file info and verify ownership file_info = await conn.fetchrow("""