Skip to content

fix: prevent serverIp from being overwritten on every user registration#4216

Merged
Siumauricio merged 1 commit intoDokploy:canaryfrom
nizepart:fix/server-ip-override-on-user-creation
Apr 14, 2026
Merged

fix: prevent serverIp from being overwritten on every user registration#4216
Siumauricio merged 1 commit intoDokploy:canaryfrom
nizepart:fix/server-ip-override-on-user-creation

Conversation

@nizepart
Copy link
Copy Markdown

@nizepart nizepart commented Apr 13, 2026

Fixes #4215

Summary

  • Add !isAdminPresent guard to the updateWebServerSettings({ serverIp }) call in databaseHooks.user.create.after so the public IP is only auto-set during the very first admin registration, not on every subsequent user creation.

Changes

- if (!IS_CLOUD) {
+ if (!IS_CLOUD && !isAdminPresent) {
      await updateWebServerSettings({
          serverIp: await getPublicIpWithFallback(),
      });
  }

isAdminPresent is already queried in the same scope (checks if an owner role exists in the member table). 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

  • 1 line changed, 1 file -- minimal, safe diff.
  • No effect on the manual "Update Server IP" dialog -- admins can still change the IP at any time.
  • No effect on license validation -- it calls getPublicIpWithFallback() directly without writing to webServerSettings.
  • No effect on cloud deployments -- the IS_CLOUD guard already skips this code path.

Greptile Summary

This PR adds a !isAdminPresent guard to the updateWebServerSettings({ serverIp }) call in the databaseHooks.user.create.after handler 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 — isAdminPresent is already queried at the top of the after hook (line 195) before the member insert 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: isAdminPresent is queried before the owner member record is inserted, so it's null on 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!

@nizepart nizepart requested a review from Siumauricio as a code owner April 13, 2026 17:06
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 13, 2026
@Siumauricio Siumauricio merged commit d99f2cd into Dokploy:canary Apr 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server IP is silently overwritten on every user registration

2 participants