feat: Enhance deployment scripts with environment variable validation and loading

This commit is contained in:
2025-09-12 09:21:53 +02:00
parent 95ef139843
commit c1d49689da
3 changed files with 50 additions and 0 deletions

View File

@@ -7,6 +7,34 @@ set GIT_BRANCH=%2
if "%GIT_BRANCH%"=="" set GIT_BRANCH=ui-fix
set GIT_COMMIT=%3
REM Check if .env.production exists
if exist .env.production (
echo Loading production environment variables...
for /f "delims=" %%x in (.env.production) do (
set "%%x"
)
) else (
echo Warning: .env.production not found. Make sure environment variables are set!
)
REM Validate critical environment variables
if "%NEXTAUTH_SECRET%"=="" (
echo ERROR: NEXTAUTH_SECRET must be set to a secure random string!
echo Generate one with: openssl rand -base64 32
exit /b 1
)
@REM if "%NEXTAUTH_SECRET%"=="YOUR_SUPER_SECURE_SECRET_KEY_HERE_AT_LEAST_32_CHARACTERS_LONG" (
@REM echo ERROR: NEXTAUTH_SECRET must be changed from the default value!
@REM echo Generate one with: openssl rand -base64 32
@REM exit /b 1
@REM )
if "%NEXTAUTH_URL%"=="" (
echo ERROR: NEXTAUTH_URL must be set to your production URL!
exit /b 1
)
if "%GIT_REPO_URL%"=="" (
echo Building from local files...
docker-compose -f docker-compose.prod.yml build