[PR #4516] [CLOSED] feat: prefer CLI flags over environment variables #25666

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4516
Author: @nazarewk
Created: 9/18/2025
Status: Closed

Base: mainHead: feat/flag-precedence


📝 Commits (1)

  • 5f6cf0c feat: prefer direct flags to envvars

📊 Changes

3 files changed (+9 additions, -0 deletions)

View changed files

📝 client/cmd/root.go (+3 -0)
📝 relay/cmd/env.go (+3 -0)
📝 signal/cmd/env.go (+3 -0)

📄 Description

DO-NOT-MERGE (see the description)

Describe your changes

Makes NetBird CLI behave with the usual precedence of the command line tooling, where directly passed command line flags take precedence over environment variables.

The general consensus is that we should not change this behavior right now, because it was working like this since forever and we might have users & customers depending on this behavior.

There are at least 2 examples of flags where envvar taking precedence over CLI flag makes sense (centrally-managed devices that user should not be able to reconfigure):

  1. --disable-profiles / NB_DISABLE_PROFILES
  2. --disable-update-settings / NB_DISABLE_UPDATE_SETTINGS

https://github.com/netbirdio/netbird/issues/4515

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

Documentation update will be needed if/when we decide to merge this.

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 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/4516 **Author:** [@nazarewk](https://github.com/nazarewk) **Created:** 9/18/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/flag-precedence` --- ### 📝 Commits (1) - [`5f6cf0c`](https://github.com/netbirdio/netbird/commit/5f6cf0ca8182880f05cf9b1891157a27f0878a67) feat: prefer direct flags to envvars ### 📊 Changes **3 files changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/root.go` (+3 -0) 📝 `relay/cmd/env.go` (+3 -0) 📝 `signal/cmd/env.go` (+3 -0) </details> ### 📄 Description DO-NOT-MERGE (see the description) ## Describe your changes Makes NetBird CLI behave with the usual precedence of the command line tooling, where directly passed command line flags take precedence over environment variables. The general consensus is that we should not change this behavior right now, because it was working like this since forever and we might have users & customers depending on this behavior. There are at least 2 examples of flags where envvar taking precedence over CLI flag makes sense (centrally-managed devices that user should not be able to reconfigure): 1. `--disable-profiles` / `NB_DISABLE_PROFILES` 2. `--disable-update-settings` / `NB_DISABLE_UPDATE_SETTINGS` ## Issue ticket number and link https://github.com/netbirdio/netbird/issues/4515 ## Stack <!-- branch-stack --> ### 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) > 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 Documentation update will be needed if/when we decide to merge this. ### 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/__ --- <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 07:06:18 -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#25666