Enforce authenticated user verification on startup in main.py
This commit is contained in:
@@ -58,6 +58,15 @@ async def main() -> None:
|
||||
|
||||
# Initialize Gitea components
|
||||
client: GiteaClient = GiteaClient()
|
||||
try:
|
||||
user = client.get_authenticated_user()
|
||||
if not user or not user.login:
|
||||
raise RuntimeError("No authenticated user found.")
|
||||
logger.info(f"Authenticated as user: {user.login}")
|
||||
except Exception as e:
|
||||
logger.critical(f"Critical initialization error: No authenticated user found. {e}")
|
||||
raise SystemExit(1)
|
||||
|
||||
tools: GiteaTools = GiteaTools(client)
|
||||
model_name: str = AGENT_MODEL_ID
|
||||
|
||||
|
||||
Reference in New Issue
Block a user