Skip to content

Commit

Permalink
more strict checks on environment variable for reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedkhaleel2004 committed Dec 24, 2024
1 parent 87c78b5 commit 8c98870
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cd ~/gitdiagram
# Pull latest changes
git pull origin main

# Build and restart containers
# Build and restart containers with production environment
docker-compose down
ENVIRONMENT=production docker-compose up --build -d

Expand Down
9 changes: 8 additions & 1 deletion backend/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash

echo "Current ENVIRONMENT: $ENVIRONMENT"

if [ "$ENVIRONMENT" = "development" ]; then
echo "Starting in development mode with hot reload..."
exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
else
elif [ "$ENVIRONMENT" = "production" ]; then
echo "Starting in production mode with multiple workers..."
exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2
else
echo "ENVIRONMENT must be set to either 'development' or 'production'"
exit 1
fi

0 comments on commit 8c98870

Please sign in to comment.