-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_api_server.py
More file actions
executable file
·55 lines (45 loc) · 1.73 KB
/
start_api_server.py
File metadata and controls
executable file
·55 lines (45 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
"""
Start FastAPI server with webhook support.
This script starts the FastAPI server with proper configuration
for webhook testing and debugging.
"""
import sys
from pathlib import Path
# Add project root to path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
import uvicorn
from config import get_config
if __name__ == "__main__":
config = get_config()
webhook_config = config.webhooks
print("=" * 70)
print("🚀 Starting Sentinel AIOps API Server")
print("=" * 70)
print(f"\n📋 Configuration:")
print(f" Webhooks enabled: {webhook_config.enabled}")
print(f" Slack enabled: {webhook_config.slack.enabled}")
print(f" Slack channel: {webhook_config.slack.channel}")
print(f" PagerDuty enabled: {webhook_config.pagerduty.enabled}")
if webhook_config.slack.enabled and not webhook_config.slack.webhook_url:
print("\n⚠️ WARNING: Slack enabled but webhook URL not configured!")
print(" Add SENTINEL_SLACK_WEBHOOK_URL to your .env file")
if (
webhook_config.pagerduty.enabled
and not webhook_config.pagerduty.integration_key
):
print("\n⚠️ WARNING: PagerDuty enabled but integration key not configured!")
print(" Add SENTINEL_PAGERDUTY_INTEGRATION_KEY to your .env file")
print("\n🌐 Starting server on http://0.0.0.0:8000")
print(" API Docs: http://localhost:8000/docs")
print(" Health: http://localhost:8000/health")
print(" Webhook Status: http://localhost:8000/api/v1/webhooks/status")
print("\n" + "=" * 70 + "\n")
uvicorn.run(
"src.app.main:app",
host="0.0.0.0",
port=8000,
reload=True,
log_level="info",
)