refactor: improve error handling and remove hardcoded credentials
- Changed bare except clauses to specific exception types in web3_utils.py, testing.py, messages.py, and message_storage.py - Replaced print() calls with logger in testing.py, agent_discovery.py, compliance_agent.py, coordinator.py, trading_agent.py, keys.py, escrow.py, persistent_spending_tracker.py, sync_cli.py, and client.py - Added logger initialization using get_logger(__name__) in compliance_agent.py, coordinator.py, trading_agent.py, keys.py, escrow.py, persistent_spending_tracker.py, and client.py - Removed hardcoded secret
This commit is contained in:
37
scripts/wrappers/aitbc-agent-management-wrapper.py
Normal file
37
scripts/wrappers/aitbc-agent-management-wrapper.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Wrapper script for aitbc-agent-management service
|
||||
Uses centralized aitbc utilities for path configuration
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Add aitbc to path
|
||||
sys.path.insert(0, str(Path("/opt/aitbc")))
|
||||
|
||||
from aitbc.constants import DATA_DIR, LOG_DIR, REPO_DIR
|
||||
|
||||
# Set up environment
|
||||
os.environ["PYTHONPATH"] = f"{REPO_DIR}:{REPO_DIR}/apps/agent-management/src:{REPO_DIR}/apps/coordinator-api/src"
|
||||
os.environ["DATA_DIR"] = str(DATA_DIR / "agent-management")
|
||||
os.environ["LOG_DIR"] = str(LOG_DIR / "agent-management")
|
||||
|
||||
# Create required directories
|
||||
from aitbc.utils.paths import ensure_dir
|
||||
ensure_dir(DATA_DIR / "agent-management")
|
||||
ensure_dir(LOG_DIR / "agent-management")
|
||||
|
||||
# Execute the actual service
|
||||
exec_cmd = [
|
||||
"/opt/aitbc/venv/bin/python",
|
||||
"-m",
|
||||
"uvicorn",
|
||||
"app.main:app",
|
||||
"--host",
|
||||
"127.0.0.1",
|
||||
"--port",
|
||||
"8012",
|
||||
]
|
||||
os.execvp(exec_cmd[0], exec_cmd)
|
||||
Reference in New Issue
Block a user