fix: prevent serverIp from being overwritten on every user registration#4216
Merged
Siumauricio merged 1 commit intoDokploy:canaryfrom Apr 14, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #4215
Summary
!isAdminPresentguard to theupdateWebServerSettings({ serverIp })call indatabaseHooks.user.create.afterso the public IP is only auto-set during the very first admin registration, not on every subsequent user creation.Changes
isAdminPresentis already queried in the same scope (checks if an owner role exists in themembertable). On first setup no owner exists yet, so the IP is auto-detected as before. On all subsequent user creations an owner already exists, so the block is skipped and the stored IP is preserved.Impact
getPublicIpWithFallback()directly without writing towebServerSettings.IS_CLOUDguard already skips this code path.Greptile Summary
This PR adds a
!isAdminPresentguard to theupdateWebServerSettings({ serverIp })call in thedatabaseHooks.user.create.afterhandler so the server IP is only auto-detected during the very first admin registration rather than on every subsequent user creation. The fix is minimal and correct —isAdminPresentis already queried at the top of theafterhook (line 195) before thememberinsert transaction, so it accurately reflects whether an owner already exists at the time each user is created.Confidence Score: 5/5
Safe to merge — one-line guard change with correct logic and no side effects on other code paths.
The fix is logically sound:
isAdminPresentis queried before the ownermemberrecord is inserted, so it'snullon first-admin setup and truthy thereafter. All guarded code paths (IS_CLOUD, manual IP update, license validation) are unaffected. No P0 or P1 findings.No files require special attention.
Reviews (1): Last reviewed commit: "fix: prevent serverIp from being overwri..." | Re-trigger Greptile
(4/5) You can add custom instructions or style guidelines for the agent here!