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)