[PR #5263] [client] reuse logic in both up and login - login now respects env + persist config #25413

Open
opened 2026-08-05 07:05:59 -04:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/5263

State: closed
Merged: No


Describe your changes

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

This is completely untested thus far, but should be a pretty solid base.

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

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

Not needed, as it just matches what should currently be happening, ie. bugfix.

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

  • Refactor

    • Centralized startup and "up" flows around a single config-input path and simplified CLI surface to a focused set of options (preshared-key, interface, wireguard-port, network-monitor, dns-router-interval, mtu).
    • Consolidated daemon integration so CLI inputs translate consistently into service config/login requests.
  • Bug Fixes / Reliability

    • Improved foreground and daemon login orchestration, safer profile switching, better error handling, and clearer success feedback ("Logged in successfully").
  • Enhancements

    • Broader config coverage (DNS/NAT, MTU, WireGuard port, SSH TTL, feature flags) exposed to CLI flows.
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/5263 **State:** closed **Merged:** No --- ## Describe your changes 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 This is completely untested thus far, but should be a pretty solid base. ## Issue ticket number and link Discussed it on Slack https://netbirdio.slack.com/archives/C02KHAE8VLZ/p1770216154715019 ## 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 Not needed, as it just matches what should currently be happening, ie. bugfix. ### 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 * **Refactor** * Centralized startup and "up" flows around a single config-input path and simplified CLI surface to a focused set of options (preshared-key, interface, wireguard-port, network-monitor, dns-router-interval, mtu). * Consolidated daemon integration so CLI inputs translate consistently into service config/login requests. * **Bug Fixes / Reliability** * Improved foreground and daemon login orchestration, safer profile switching, better error handling, and clearer success feedback ("Logged in successfully"). * **Enhancements** * Broader config coverage (DNS/NAT, MTU, WireGuard port, SSH TTL, feature flags) exposed to CLI flows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 07:05:59 -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#25413