infrasynth-backend-kit/infrasynth/configs/apps.py
jcv-dev a2930426b4 feat: tenant configs, live signals, and automatic permission management
- infrasynth.configs: typed multi-tenant config store (registry, service,
  secrets, cache) + public config_changed/config_reset signals and API
- emit the declared-but-dead signals (features flags/overrides, scheduler
  task_completed/task_failed, tenancy tenant_updated, audit model_changed)
  and per-model audit field exclusions
- security: permission catalog (security_permission), Django-style
  model-derived AutoPermission, PermissionRegistry, RoleAssignment,
  global-or-tenant Grant/Revoke, catalog API
- consolidate the permission surface: PermissionRegistry only (drop the
  settings dict), IsAuthenticatedAndPermitted aliases HybridPermission,
  require_permission replaced by required_permissions + require_all
- packaging: add [build-system]; add Forgejo publish workflow (.forgejo)
2026-09-29 17:06:54 -05:00

28 lines
1,021 B
Python

from django.apps import AppConfig
class ConfigsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "infrasynth.configs"
label = "infrasynth_configs"
def ready(self):
from infrasynth.features.registry import FeatureRegistry
from infrasynth.shared.settings_utils import get_setting
from .registry import ConfigRegistry, ConfigType
FeatureRegistry.register(
"configs",
name="Tenant Configuration",
description="Typed per-tenant configuration values",
default=True,
category="system",
)
if get_setting("INFRASYNTH_CONFIGS", "AUTO_REGISTER_FROM_SETTINGS", True):
for key, spec in (get_setting("INFRASYNTH_CONFIGS", "DEFINITIONS", {}) or {}).items():
spec = dict(spec or {})
if isinstance(spec.get("type"), str):
spec["type"] = ConfigType(spec["type"])
ConfigRegistry.register(key, **spec)