Fix: ReferenceError in setupDefaultUser when using INITIAL_ADMIN_EMAIL/PASSWORD env vars #4836
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes a critical bug in
backend/setup.jswhere settingINITIAL_ADMIN_EMAILandINITIAL_ADMIN_PASSWORDenvironment variables causes the application to crash with a ReferenceError during initial setup.The Problem
When using environment variables to configure the initial admin account:
initialAdminEmailandinitialAdminPasswordare correctly read from environment variablesemailandpasswordwhen creating the userReferenceError: email is not definedand the app enters an infinite restart loopThe Solution
Fixed variable references in
setupDefaultUser()function:email: email→email: initialAdminEmailsecret: password→secret: initialAdminPasswordTesting
Built and tested locally with the fix:
Build Process
./scripts/ci/frontend-build docker build -f docker/Dockerfile -t nginx-proxy-manager:local .Test Configuration
Test Results
Before Fix (infinite restart loop)
After Fix (successful startup)
✅ Application starts successfully
✅ Initial admin user created with specified credentials
✅ Successfully logged in to admin panel at :81 with configured credentials
✅ No restart loops or errors
Impact
This bug prevents automated deployments that rely on environment variables for initial setup, forcing users to:
Related Issues
Type of Change
Checklist
Additional Changes: Docker Publish Workflow
This PR also includes a new GitHub Actions workflow located at
.github/workflows/docker-publish.yml.Purpose
This workflow automates the process of building and pushing multi-architecture Docker images to Docker Hub for the
developbranch.Key Features
linux/amd64,linux/arm64, andlinux/arm/v7.developbranch and can also be manually dispatched from the GitHub Actions UI.frontend/distdirectory based on changes infrontend/yarn.lock,frontend/package.json,frontend/vite.config.ts,frontend/tsconfig.json, and all files infrontend/src/**, ensuring rebuilds only occur when necessary.DOCKERHUB_USERNAMEsecret to dynamically determine the Docker Hub repository name.DOCKERHUB_USERNAMEorDOCKERHUB_TOKENsecrets are not defined in the repository, preventing failed runs.