dev: prefer .env.development in start script

This commit is contained in:
Chris
2026-04-03 04:51:00 +08:00
parent 7b9915e81c
commit d2b6957013

View File

@@ -3,9 +3,14 @@ set -euo pipefail
cd "$(dirname "$0")/.."
source .venv/bin/activate
ENV_FILE=".env"
if [ ! -f "$ENV_FILE" ]; then
echo "missing $ENV_FILE. copy .env.example to .env first."
if [ -f ".env.development" ]; then
ENV_FILE=".env.development"
elif [ -f ".env" ]; then
ENV_FILE=".env"
else
echo "missing .env.development or .env. copy .env.example first."
exit 1
fi
echo "Loading environment from '$ENV_FILE'"
exec uvicorn app.main:app --env-file "$ENV_FILE" --host 127.0.0.1 --port 8000 --reload