-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (40 loc) · 1.18 KB
/
main.py
File metadata and controls
50 lines (40 loc) · 1.18 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
#!/usr/bin/env python3
"""
FlyMe Bot - A Real-Time Slack Bot for Flights
Main entry point for the application
"""
import asyncio
import sys
from dotenv import load_dotenv
from config import Config
from app import FlyMeApp
def main():
"""Main entry point"""
# Load environment variables
load_dotenv()
# Load and validate configuration
config = Config.from_env()
missing = config.validate()
if missing:
print(f"[ERROR] Missing required environment variables: {', '.join(missing)}")
print("\nPlease ensure all required variables are set in your .env file:")
print(" - ARCADE_API_KEY")
print(" - OPENAI_API_KEY")
print(" - SLACK_BOT_TOKEN")
print(" - SLACK_APP_TOKEN")
sys.exit(1)
# Create and run application
app = FlyMeApp(config)
try:
asyncio.run(run_app(app))
except (KeyboardInterrupt, SystemExit):
pass
except Exception as e:
print(f"Fatal error: {e}")
sys.exit(1)
async def run_app(app: FlyMeApp):
"""Run the application with proper initialization"""
await app.initialize()
await app.run()
if __name__ == "__main__":
main()