Initialisation depot
This commit is contained in:
37
samba-api/start.sh
Normal file
37
samba-api/start.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "=== Samba API Startup ==="
|
||||
echo "HOST: ${HOST:-0.0.0.0}"
|
||||
echo "HTTP PORT: ${PORT:-8000}"
|
||||
echo "HTTPS PORT: ${HTTPS_PORT:-8443}"
|
||||
echo "USE_HTTPS: ${USE_HTTPS:-false}"
|
||||
|
||||
# Prepare reload flag
|
||||
if [ "${DEBUG:-false}" = "true" ]; then
|
||||
RELOAD_FLAG="--reload"
|
||||
else
|
||||
RELOAD_FLAG=""
|
||||
fi
|
||||
|
||||
# Check if SSL certificates exist and HTTPS is enabled
|
||||
if [ -f "/app/ssl/server.key" ] && [ -f "/app/ssl/server.crt" ] && [ "${USE_HTTPS}" = "true" ]; then
|
||||
echo "✓ SSL certificates found"
|
||||
echo "✓ HTTPS enabled"
|
||||
echo "🚀 Starting Samba API with HTTPS on port ${HTTPS_PORT:-8443}"
|
||||
exec python -m uvicorn main:app \
|
||||
--host ${HOST:-0.0.0.0} \
|
||||
--port ${HTTPS_PORT:-8443} \
|
||||
--ssl-keyfile /app/ssl/server.key \
|
||||
--ssl-certfile /app/ssl/server.crt \
|
||||
${RELOAD_FLAG}
|
||||
else
|
||||
if [ "${USE_HTTPS}" = "true" ]; then
|
||||
echo "⚠️ HTTPS requested but SSL certificates not found, falling back to HTTP"
|
||||
fi
|
||||
echo "🚀 Starting Samba API with HTTP on port ${PORT:-8000}"
|
||||
exec python -m uvicorn main:app \
|
||||
--host ${HOST:-0.0.0.0} \
|
||||
--port ${PORT:-8000} \
|
||||
${RELOAD_FLAG}
|
||||
fi
|
||||
Reference in New Issue
Block a user