[PR #5412] [CLOSED] [client] reuse logic in both up and login - login now respects env + persist config #22966

Open
opened 2026-08-05 06:06:37 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5412
Author: @eyJhb
Created: 2/22/2026
Status: Closed

Base: mainHead: client-login-management


📝 Commits (10+)

  • e41627a move some logic from up to login
  • 206e8d5 moved up flags into up file instead of root
  • e87fed6 moved input config variables back to up handler
  • 675fb74 moved logic from up into login for reusing it
  • 084e044 fixed comments from ai
  • b663c24 minor fix on not propagating error
  • 136a066 minor nitpicks
  • a63a5de more nitpicking
  • 7c03105 fixes typo
  • 4f808c9 fixes the already connected case - just do like is currently done, bug for bug

📊 Changes

3 files changed (+423 additions, -502 deletions)

View changed files

📝 client/cmd/login.go (+237 -51)
📝 client/cmd/root.go (+6 -38)
📝 client/cmd/up.go (+180 -413)

📄 Description

Describe your changes

Reopening because my previous PR was closed, because a new PR was merged, which doesn't resolve the issue I initially had. These changes still apply cleanly on top of the other PR :)

I've moved a bunch of logic from up, into login, and then reused it for both commands.

  • Moved logic from up.go into login.go (reason for using login.go, was that up.go seemed to rely heavily on it anyways)
  • Moved flags from root.go into up.go, unsure why they were placed there
  • login will now respect env
  • login will now save the configuration

Discussed it on Slack https://netbirdio.slack.com/archives/C02KHAE8VLZ/p1770216154715019

Previous PR https://github.com/netbirdio/netbird/pull/5263

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features

    • Daemon-aware login that auto-selects foreground vs. daemon mode.
    • New up command flags for interface blacklist, external IP mapping, DNS resolver, Rosenpass, auto-connect and lazy-connection behavior.
  • Changes

    • Unified config input for login and up flows; simplified daemon interactions.
    • CLI flags reorganized (some flags removed from root and surfaced/changed on up).
    • Deprecation warning when using --config with the service.
    • Updated success message: "Logged in successfully".

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5412 **Author:** [@eyJhb](https://github.com/eyJhb) **Created:** 2/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `client-login-management` --- ### 📝 Commits (10+) - [`e41627a`](https://github.com/netbirdio/netbird/commit/e41627a0ad1bfc5de089bd0193e26ac4e0efbda0) move some logic from up to login - [`206e8d5`](https://github.com/netbirdio/netbird/commit/206e8d5e809517723966b22ef34c97815dd6bcd2) moved up flags into up file instead of root - [`e87fed6`](https://github.com/netbirdio/netbird/commit/e87fed61c4553564642bd88eb415a5142220cf67) moved input config variables back to up handler - [`675fb74`](https://github.com/netbirdio/netbird/commit/675fb74c6e578d8c9a512169affdb535cfb9a530) moved logic from up into login for reusing it - [`084e044`](https://github.com/netbirdio/netbird/commit/084e044cf5489eac607e736861c8a3d046762687) fixed comments from ai - [`b663c24`](https://github.com/netbirdio/netbird/commit/b663c245758b8b2e63663a86e2dd8bca30a5b730) minor fix on not propagating error - [`136a066`](https://github.com/netbirdio/netbird/commit/136a066cb1b189e580c8991b0417725599d8a83d) minor nitpicks - [`a63a5de`](https://github.com/netbirdio/netbird/commit/a63a5de3188bc5690965eabc38c347fa901d56aa) more nitpicking - [`7c03105`](https://github.com/netbirdio/netbird/commit/7c031057ef2a8efa6dc9d1954140c4eb06f488bb) fixes typo - [`4f808c9`](https://github.com/netbirdio/netbird/commit/4f808c93eb0d232101076bef820043848c2a0929) fixes the already connected case - just do like is currently done, bug for bug ### 📊 Changes **3 files changed** (+423 additions, -502 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/login.go` (+237 -51) 📝 `client/cmd/root.go` (+6 -38) 📝 `client/cmd/up.go` (+180 -413) </details> ### 📄 Description ## Describe your changes Reopening because my previous PR was closed, because a new PR was merged, which doesn't resolve the issue I initially had. These changes still apply cleanly on top of the other PR :) I've moved a bunch of logic from up, into login, and then reused it for both commands. - Moved logic from up.go into login.go (reason for using login.go, was that up.go seemed to rely heavily on it anyways) - Moved flags from root.go into up.go, unsure why they were placed there - login will now respect env - login will now save the configuration ## Issue ticket number and link Discussed it on Slack https://netbirdio.slack.com/archives/C02KHAE8VLZ/p1770216154715019 Previous PR https://github.com/netbirdio/netbird/pull/5263 ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Daemon-aware login that auto-selects foreground vs. daemon mode. * New up command flags for interface blacklist, external IP mapping, DNS resolver, Rosenpass, auto-connect and lazy-connection behavior. * **Changes** * Unified config input for login and up flows; simplified daemon interactions. * CLI flags reorganized (some flags removed from root and surfaced/changed on up). * Deprecation warning when using --config with the service. * Updated success message: "Logged in successfully". <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/netbirdio/netbird/pull/5412) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 06:06:37 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#22966