[PR #2401] [CLOSED] [WIP] profile switching (multiple networks) #17208

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2401
Author: @oskardotglobal
Created: 8/6/2024
Status: Closed

Base: mainHead: main


📝 Commits (6)

  • 1dd6220 feat: profile switching (multiple networks)
  • 12bbb0a feat: refactor command usage
  • 7f1284e fix: use profiles dir relative to config file
  • 481545e feat: move switching logic to daemon
  • 936dac8 feat: --profile flags for up and login commands
  • 8d1999e Merge remote-tracking branch 'upstream/main'

📊 Changes

11 files changed (+964 additions, -31 deletions)

View changed files

📝 client/cmd/login.go (+23 -0)
client/cmd/profile.go (+102 -0)
📝 client/cmd/root.go (+4 -0)
📝 client/cmd/up.go (+20 -0)
📝 client/proto/daemon.pb.go (+432 -29)
📝 client/proto/daemon.proto (+35 -1)
📝 client/proto/daemon_grpc.pb.go (+114 -0)
📝 client/proto/generate.sh (+1 -1)
client/server/profile.go (+221 -0)
📝 client/server/server.go (+9 -0)
📝 client/ui/client_ui.go (+3 -0)

📄 Description

Describe your changes

This issue attempts to support switching between multiple management servers and/or users ("networks") as described in #446.

I have thought of 3 approaches to implement this:

  1. Rewrite the config and daemon in large parts to support this
  2. Somehow store the currently used config both in the daemon and client persistently (config for config path, anyone?)
  3. Have multiple configs and symlink to /etc/netbird/config.json and restart the daemon after changing configs

For obvious reasons, I decided on approach 3. I'm still currently facing an issue where the service doesn't start on macOS unless I reinstall it, but otherwise this works. A GUI integration is planned, but I won't be writing support for Android / iOS anytime soon.

The usage looks like this:

netbird profiles # list profiles
netbird profile # show current profile
netbird profile <name> # switch to profile <name> (/etc/netbird/profiles/<name>.json)

#2233
#446 (in parts)

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)
  • Extended the README / documentation, if necessary

🔄 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/2401 **Author:** [@oskardotglobal](https://github.com/oskardotglobal) **Created:** 8/6/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (6) - [`1dd6220`](https://github.com/netbirdio/netbird/commit/1dd622020bc4fe9aa8613da05dff3d6229d2a2d2) feat: profile switching (multiple networks) - [`12bbb0a`](https://github.com/netbirdio/netbird/commit/12bbb0a96ce803fbceb051be404744e0f4a9e0a7) feat: refactor command usage - [`7f1284e`](https://github.com/netbirdio/netbird/commit/7f1284ec256edcf0ca85efbfc701ff0f80839368) fix: use profiles dir relative to config file - [`481545e`](https://github.com/netbirdio/netbird/commit/481545e1ab8185d702c032e25ce84328dd7f4a3d) feat: move switching logic to daemon - [`936dac8`](https://github.com/netbirdio/netbird/commit/936dac8e6c7c0e955ee628ed9d3013521b95c9bf) feat: --profile flags for up and login commands - [`8d1999e`](https://github.com/netbirdio/netbird/commit/8d1999e2d351890ccf52e15e7e2db02fb26fe48e) Merge remote-tracking branch 'upstream/main' ### 📊 Changes **11 files changed** (+964 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/login.go` (+23 -0) ➕ `client/cmd/profile.go` (+102 -0) 📝 `client/cmd/root.go` (+4 -0) 📝 `client/cmd/up.go` (+20 -0) 📝 `client/proto/daemon.pb.go` (+432 -29) 📝 `client/proto/daemon.proto` (+35 -1) 📝 `client/proto/daemon_grpc.pb.go` (+114 -0) 📝 `client/proto/generate.sh` (+1 -1) ➕ `client/server/profile.go` (+221 -0) 📝 `client/server/server.go` (+9 -0) 📝 `client/ui/client_ui.go` (+3 -0) </details> ### 📄 Description ## Describe your changes This issue attempts to support switching between multiple management servers and/or users ("networks") as described in #446. I have thought of 3 approaches to implement this: 1. Rewrite the config and daemon in large parts to support this 2. Somehow store the currently used config both in the daemon and client *persistently* (config for config path, anyone?) 3. Have multiple configs and symlink to /etc/netbird/config.json and restart the daemon after changing configs For obvious reasons, I decided on approach 3. I'm still currently facing an issue where the service doesn't start on macOS unless I reinstall it, but otherwise this works. A GUI integration is planned, but I won't be writing support for Android / iOS anytime soon. The usage looks like this: ```sh netbird profiles # list profiles netbird profile # show current profile netbird profile <name> # switch to profile <name> (/etc/netbird/profiles/<name>.json) ``` ## Issue ticket number and link #2233 #446 (in parts) ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <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 04:07:03 -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#17208