INNER CODE UNIT · Python
_get_plugin_enabled
CaddyGlow/ccproxy-api · ccproxy/api/app.py:325
def _get_plugin_enabled(name: str) -> bool:
plugins_cfg = getattr(settings, "plugins", None)
if plugins_cfg is None:
return False
# dict-like
if isinstance(plugins_cfg, dict):
cfg = plugins_cfg.get(name)
if isinstance(cfg, dict):
return bool(cfg.get("enabled", False))
try:
return bool(getattr(cfg, "enabled", False))
except Exception:
return False
# object-like
try:
sub = getattr(plugins_cfg, name, None)
return bool(getattr(sub, "enabled", False))
except Exception: