Support .env.local override in run_local.sh for developer-specific configurations

This commit is contained in:
MartinBraquet
2026-07-25 16:50:19 +02:00
parent fe5dc02321
commit e8134fcc14

View File

@@ -21,15 +21,20 @@ esac
WEB_DIR=web
# `.env.local` first: dotenv-cli loads the files in order and never overwrites an already-set
# variable, so the first file listed wins. That makes `.env.local` the per-developer override of the
# shared `.env`, matching Next.js' own precedence. A missing file is silently skipped.
DOTENV_FILES=(-e .env.local -e .env)
if [ "$ENVIRONMENT" = "prod" ]; then
npx dotenv -e .env -- npx concurrently \
npx dotenv "${DOTENV_FILES[@]}" -- npx concurrently \
-n API,NEXT,TS \
-c white,magenta,cyan \
"cross-env ENVIRONMENT=$NEXT_ENV yarn --cwd=backend/api prod" \
"cross-env NEXT_PUBLIC_FIREBASE_ENV=$NEXT_ENV yarn --cwd=$WEB_DIR serve" \
"cross-env yarn --cwd=$WEB_DIR ts-watch"
else
npx dotenv -e .env -- npx concurrently \
npx dotenv "${DOTENV_FILES[@]}" -- npx concurrently \
-n API,NEXT \
-c white,magenta \
"cross-env ENVIRONMENT=$NEXT_ENV yarn --cwd=backend/api dev" \