INNER CODE UNIT · Python
_sync_oauth2_config_from_db
derisk-ai/OpenDerisk · packages/derisk-app/src/derisk_app/app.py:233
def _sync_oauth2_config_from_db():
"""Sync OAuth2 config from database to runtime config on startup.
This ensures that after deployment/restart, the OAuth2 configuration
stored in database (which survives redeployment) is loaded into
the in-memory config used by the application.
"""
try:
from derisk_app.config_storage.oauth2_db_storage import get_oauth2_db_storage
from derisk_core.config import ConfigManager, OAuth2Config
db_storage = get_oauth2_db_storage()
# Load with actual secrets for runtime use
db_oauth2 = db_storage.load_with_secrets()
if db_oauth2 is not None:
# Update the runtime config with database values
cfg = ConfigManager.get()