Improved app_config.get_config_value - added ability to get hierarchical YAML configs
This commit is contained in:
parent
d2df6a005b
commit
202a3eb383
@ -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\
|
||||
|
||||
2
main.py
2
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("""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user