Improved app_config.get_config_value - added ability to get hierarchical YAML configs

This commit is contained in:
Anry Das 2025-10-11 16:54:58 +03:00
parent d2df6a005b
commit 202a3eb383
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,12 @@ def read_app_config():
return j
def get_config_value(cfg, section, key, 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):

View File

@ -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("""