MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / reload_config_to_memory

Method reload_config_to_memory

src/core/database.py:1669–1735  ·  view source on GitHub ↗

Reload all configuration from database to in-memory Config instance. This should be called after any configuration update to ensure hot-reload. Includes: - Admin config (username, password, api_key) - Cache config (enabled, timeout, base_url) - Gener

(self)

Source from the content-addressed store, hash-verified

1667 await db.commit()
1668
1669 async def reload_config_to_memory(self):
1670 """
1671 Reload all configuration from database to in-memory Config instance.
1672 This should be called after any configuration update to ensure hot-reload.
1673
1674 Includes:
1675 - Admin config (username, password, api_key)
1676 - Cache config (enabled, timeout, base_url)
1677 - Generation config (image_timeout, video_timeout)
1678 - Proxy config will be handled by ProxyManager
1679 """
1680 from .config import config
1681
1682 # Reload admin config
1683 admin_config = await self.get_admin_config()
1684 if admin_config:
1685 config.set_admin_username_from_db(admin_config.username)
1686 config.set_admin_password_from_db(admin_config.password)
1687 config.api_key = admin_config.api_key
1688
1689 # Reload cache config
1690 cache_config = await self.get_cache_config()
1691 if cache_config:
1692 config.set_cache_enabled(cache_config.cache_enabled)
1693 config.set_cache_timeout(cache_config.cache_timeout)
1694 config.set_cache_base_url(cache_config.cache_base_url or "")
1695
1696 # Reload generation config
1697 generation_config = await self.get_generation_config()
1698 if generation_config:
1699 config.set_image_timeout(generation_config.image_timeout)
1700 config.set_video_timeout(generation_config.video_timeout)
1701 config.set_flow_max_retries(generation_config.max_retries)
1702
1703 # Reload call logic config
1704 call_logic_config = await self.get_call_logic_config()
1705 if call_logic_config:
1706 config.set_call_logic_mode(call_logic_config.call_mode)
1707
1708 # Reload debug config
1709 debug_config = await self.get_debug_config()
1710 if debug_config:
1711 config.set_debug_enabled(debug_config.enabled)
1712
1713 # Reload captcha config
1714 captcha_config = await self.get_captcha_config()
1715 if captcha_config:
1716 config.set_captcha_method(captcha_config.captcha_method)
1717 config.set_yescaptcha_api_key(captcha_config.yescaptcha_api_key)
1718 config.set_yescaptcha_base_url(captcha_config.yescaptcha_base_url)
1719 config.set_yescaptcha_task_type(captcha_config.yescaptcha_task_type)
1720 config.set_capmonster_api_key(captcha_config.capmonster_api_key)
1721 config.set_capmonster_base_url(captcha_config.capmonster_base_url)
1722 config.set_ezcaptcha_api_key(captcha_config.ezcaptcha_api_key)
1723 config.set_ezcaptcha_base_url(captcha_config.ezcaptcha_base_url)
1724 config.set_capsolver_api_key(captcha_config.capsolver_api_key)
1725 config.set_capsolver_base_url(captcha_config.capsolver_base_url)
1726 config.set_remote_browser_base_url(captcha_config.remote_browser_base_url)

Callers 11

lifespanFunction · 0.80
change_passwordFunction · 0.80
update_generation_configFunction · 0.80
update_call_logic_configFunction · 0.80
update_api_keyFunction · 0.80
update_cache_enabledFunction · 0.80
update_cache_config_fullFunction · 0.80
update_cache_base_urlFunction · 0.80
update_captcha_configFunction · 0.80

Calls 15

get_admin_configMethod · 0.95
get_cache_configMethod · 0.95
get_generation_configMethod · 0.95
get_call_logic_configMethod · 0.95
get_debug_configMethod · 0.95
get_captcha_configMethod · 0.95
set_cache_enabledMethod · 0.80
set_cache_timeoutMethod · 0.80
set_cache_base_urlMethod · 0.80
set_image_timeoutMethod · 0.80