File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232from slowapi .middleware import SlowAPIMiddleware
3333from slowapi .util import get_remote_address
3434
35+ try :
36+ from ..api .logging_config import get_logger
37+ except ImportError :
38+ from api .logging_config import get_logger
39+
3540from .routers import (
3641 agent_router ,
3742 assistant_chat_router ,
7277ROOT_DIR = Path (__file__ ).parent .parent
7378UI_DIST_DIR = ROOT_DIR / "ui" / "dist"
7479
80+ # Logger
81+ logger = get_logger (__name__ )
82+
7583# Rate limiting configuration
7684# Using in-memory storage (appropriate for single-instance development server)
7785limiter = Limiter (key_func = get_remote_address , default_limits = ["200/minute" ])
8088@asynccontextmanager
8189async def lifespan (app : FastAPI ):
8290 """Lifespan context manager for startup and shutdown."""
83- # Startup - clean up orphaned processes from previous runs (Windows)
91+ # Startup - warn if TEST_MODE is enabled
92+ if TEST_MODE :
93+ logger .warning (
94+ "TEST_MODE is enabled - localhost restriction is bypassed. "
95+ "Requests from testclient host are also allowed."
96+ )
97+
98+ # Clean up orphaned processes from previous runs (Windows)
8499 cleanup_orphaned_agent_processes ()
85100
86101 # Clean up orphaned lock files from previous runs
You can’t perform that action at this time.
0 commit comments