diff --git a/backend/alwrity_utils/router_manager.py b/backend/alwrity_utils/router_manager.py index 183fca16..d7055ac9 100644 --- a/backend/alwrity_utils/router_manager.py +++ b/backend/alwrity_utils/router_manager.py @@ -66,6 +66,11 @@ OPTIONAL_ROUTER_REGISTRY = [ {"name": "today_workflow", "module": "api.today_workflow", "attr": "router", "profiles": {"all", "default"}}, ] +OPTIONAL_MODULE_MATRIX = { + "all": [entry["name"] for entry in OPTIONAL_ROUTER_REGISTRY], + "default": [entry["name"] for entry in OPTIONAL_ROUTER_REGISTRY], +} + class RouterManager: """Manages FastAPI router inclusion and organization.""" @@ -79,7 +84,7 @@ class RouterManager: return os.getenv("ALWRITY_VERBOSE", "false").lower() == "true" def _get_profile(self) -> str: - return os.getenv("ALWRITY_ROUTER_PROFILE", os.getenv("ALWRITY_FEATURE_TO_ENABLE", "all")).strip().lower() or "all" + return os.getenv("ALWRITY_FEATURE_PROFILE", os.getenv("ALWRITY_ROUTER_PROFILE", os.getenv("ALWRITY_FEATURE_TO_ENABLE", "all"))).strip().lower() or "all" def _should_include_router(self, registry_entry: Dict[str, Any], profile: str) -> bool: profiles = registry_entry.get("profiles", {"all", "default"}) @@ -154,3 +159,14 @@ class RouterManager: "total_included": len(self.included_routers), "total_failed": len(self.failed_routers) } + + def get_feature_profile_status(self) -> Dict[str, Any]: + """Get feature profile status and enabled modules.""" + profile = self._get_profile() + enabled_modules = OPTIONAL_MODULE_MATRIX.get(profile, OPTIONAL_MODULE_MATRIX.get("all", [])) + + return { + "active_profile": profile, + "enabled_modules": enabled_modules, + "available_profiles": list(OPTIONAL_MODULE_MATRIX.keys()) + } diff --git a/backend/app.py b/backend/app.py index e3ca55d8..24e2e800 100644 --- a/backend/app.py +++ b/backend/app.py @@ -290,6 +290,11 @@ async def router_status(): ) return status +@app.get("/api/feature-profile/status") +async def feature_profile_status(): + """Get feature profile status and enabled modules.""" + return router_manager.get_feature_profile_status() + # Onboarding management endpoints @app.get("/api/onboarding/status") async def onboarding_status(): diff --git a/backend/main.py b/backend/main.py index 049a6aeb..69938f5b 100644 --- a/backend/main.py +++ b/backend/main.py @@ -236,6 +236,11 @@ async def router_status(): """Get router inclusion status.""" return router_manager.get_router_status() +@app.get("/api/feature-profile/status") +async def feature_profile_status(): + """Get feature profile status and enabled modules.""" + return router_manager.get_feature_profile_status() + # Onboarding management endpoints @app.get("/api/onboarding/status") async def onboarding_status():