Improved app_config.get_config_value - added ability to get hierarchical YAML configs
This commit is contained in:
parent
d2df6a005b
commit
202a3eb383
@ -31,6 +31,12 @@ def read_app_config():
|
|||||||
return j
|
return j
|
||||||
|
|
||||||
def get_config_value(cfg, section, key, default):
|
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
|
return cfg[section][key] if section in cfg and key in cfg[section] else default
|
||||||
|
|
||||||
def parse_config(cfg):
|
def parse_config(cfg):
|
||||||
|
|||||||
2
main.py
2
main.py
@ -385,7 +385,7 @@ async def download_file(
|
|||||||
async def download_link(
|
async def download_link(
|
||||||
file_id: str
|
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:
|
async with db_pool.acquire() as conn:
|
||||||
# Get file info and verify ownership
|
# Get file info and verify ownership
|
||||||
file_info = await conn.fetchrow("""
|
file_info = await conn.fetchrow("""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user