This commit is contained in:
Slipstream 2025-05-10 22:32:02 -06:00
parent 3e65bdef03
commit 372dccc484
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -19,35 +19,20 @@ load_dotenv()
api_host = os.getenv("API_HOST", "0.0.0.0")
api_port = int(os.getenv("API_PORT", "8001"))
# Set SSL certificate paths
ssl_cert = os.getenv("SSL_CERT_FILE", "/etc/letsencrypt/live/slipstreamm.dev/fullchain.pem")
ssl_key = os.getenv("SSL_KEY_FILE", "/etc/letsencrypt/live/slipstreamm.dev/privkey.pem")
# SSL is now handled by a reverse proxy, so we don't configure it here.
def run_unified_api():
"""Run the unified API service (dual-stack IPv4+IPv6)"""
import multiprocessing
def run_uvicorn(bind_host):
print(f"Starting unified API service on {bind_host}:{api_port}")
ssl_available = ssl_cert and ssl_key and os.path.exists(ssl_cert) and os.path.exists(ssl_key)
if ssl_available:
print(f"Using SSL with certificates at {ssl_cert} and {ssl_key}")
uvicorn.run(
"api_service.api_server:app",
host=bind_host,
port=api_port,
log_level="debug",
ssl_certfile=ssl_cert,
ssl_keyfile=ssl_key
)
else:
print("SSL certificates not found or not configured. Starting without SSL (development mode)")
uvicorn.run(
"api_service.api_server:app",
host=bind_host,
port=api_port,
log_level="debug"
)
print(f"Starting unified API service on {bind_host}:{api_port} (HTTP only)")
uvicorn.run(
"api_service.api_server:app",
host=bind_host,
port=api_port,
log_level="debug"
)
try:
processes = []