Add improvements
This commit is contained in:
@@ -35,7 +35,6 @@ async def get_recent_actions(
|
||||
ingredient_id: Optional[str] = Query(None, description="Filter by ingredient"),
|
||||
product_id: Optional[str] = Query(None, description="Filter by product"),
|
||||
hours_ago: int = Query(24, description="Look back hours"),
|
||||
x_internal_service: str = Header(None, description="Internal service authentication")
|
||||
):
|
||||
"""
|
||||
Get recent orchestrator actions for alert context enrichment.
|
||||
@@ -52,9 +51,6 @@ async def get_recent_actions(
|
||||
|
||||
logger = structlog.get_logger()
|
||||
|
||||
# Simple internal service authentication
|
||||
if x_internal_service != "alert-intelligence":
|
||||
raise HTTPException(status_code=403, detail="Access denied")
|
||||
|
||||
try:
|
||||
settings = get_settings()
|
||||
|
||||
@@ -51,13 +51,6 @@ async def ensure_unique_run_number(db: AsyncSession, base_run_number: str) -> st
|
||||
proposed_run_number = f"{base_run_number[:50-len(random_suffix)-1]}-{random_suffix}"
|
||||
|
||||
|
||||
def verify_internal_api_key(x_internal_api_key: str = Header(...)):
|
||||
"""Verify internal API key for service-to-service communication"""
|
||||
if x_internal_api_key != settings.INTERNAL_API_KEY:
|
||||
raise HTTPException(status_code=403, detail="Invalid internal API key")
|
||||
return True
|
||||
|
||||
|
||||
async def load_fixture_data_for_tenant(
|
||||
db: AsyncSession,
|
||||
tenant_uuid: UUID,
|
||||
@@ -161,8 +154,7 @@ async def clone_demo_data(
|
||||
demo_account_type: str,
|
||||
session_id: Optional[str] = None,
|
||||
session_created_at: Optional[str] = None,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
_: bool = Depends(verify_internal_api_key)
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
Clone orchestration run demo data from base tenant to virtual tenant
|
||||
@@ -234,8 +226,7 @@ async def clone_demo_data(
|
||||
@router.delete("/tenant/{virtual_tenant_id}")
|
||||
async def delete_demo_data(
|
||||
virtual_tenant_id: str,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
_: bool = Depends(verify_internal_api_key)
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Delete all orchestration runs for a virtual demo tenant"""
|
||||
logger.info("Deleting orchestration runs for virtual tenant", virtual_tenant_id=virtual_tenant_id)
|
||||
@@ -281,6 +272,6 @@ async def delete_demo_data(
|
||||
|
||||
|
||||
@router.get("/clone/health")
|
||||
async def health_check(_: bool = Depends(verify_internal_api_key)):
|
||||
async def health_check():
|
||||
"""Health check for demo cloning endpoint"""
|
||||
return {"status": "healthy", "service": "orchestrator"}
|
||||
|
||||
Reference in New Issue
Block a user