-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
43 lines (34 loc) · 1.04 KB
/
run.py
File metadata and controls
43 lines (34 loc) · 1.04 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
#!/usr/bin/env python
# run.py - Start the GitConnectX API server
import os
import sys
import logging
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler("api_server.log"),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
def main():
"""Main entry point for the application"""
try:
# Import app from api module
from api.app import app
# Get port from environment or use default
port = int(os.environ.get('PORT', 5000))
host = os.environ.get('HOST', '0.0.0.0')
logger.info(f"Starting GitConnectX API server on {host}:{port}")
# Run the Flask application
app.run(host=host, port=port)
except Exception as e:
logger.error(f"Error starting application: {str(e)}")
sys.exit(1)
if __name__ == '__main__':
main()