mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-24 01:11:29 +02:00
Cleanup setupKey to align to linear
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
// configuration field.
|
||||
const (
|
||||
KeyManagementURL = "managementURL"
|
||||
KeySetupKey = "setupKey"
|
||||
KeyDisableAdvancedSettings = "disableAdvancedSettings"
|
||||
KeyDisableUpdateSettings = "disableUpdateSettings"
|
||||
KeyDisableProfiles = "disableProfiles"
|
||||
@@ -42,7 +41,6 @@ const (
|
||||
// configuration are ignored but logged.
|
||||
var AllKeys = []string{
|
||||
KeyManagementURL,
|
||||
KeySetupKey,
|
||||
KeyDisableAdvancedSettings,
|
||||
KeyDisableUpdateSettings,
|
||||
KeyDisableProfiles,
|
||||
@@ -62,7 +60,6 @@ var AllKeys = []string{
|
||||
|
||||
// SecretKeys lists keys whose values must be redacted in logs.
|
||||
var SecretKeys = map[string]struct{}{
|
||||
KeySetupKey: {},
|
||||
KeyPreSharedKey: {},
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestPolicy_HasKey(t *testing.T) {
|
||||
assert.False(t, p.IsEmpty())
|
||||
assert.True(t, p.HasKey(KeyManagementURL))
|
||||
assert.True(t, p.HasKey(KeyDisableProfiles))
|
||||
assert.False(t, p.HasKey(KeySetupKey))
|
||||
assert.False(t, p.HasKey(KeyPreSharedKey))
|
||||
}
|
||||
|
||||
func TestPolicy_ManagedKeysSorted(t *testing.T) {
|
||||
@@ -54,7 +54,7 @@ func TestPolicy_GetString(t *testing.T) {
|
||||
p := NewPolicy(map[string]any{
|
||||
KeyManagementURL: "https://corp.example.com",
|
||||
KeyDisableProfiles: true, // wrong type for GetString
|
||||
KeySetupKey: "", // empty rejected
|
||||
KeyPreSharedKey: "", // empty rejected
|
||||
})
|
||||
v, ok := p.GetString(KeyManagementURL)
|
||||
assert.True(t, ok)
|
||||
@@ -63,7 +63,7 @@ func TestPolicy_GetString(t *testing.T) {
|
||||
_, ok = p.GetString(KeyDisableProfiles)
|
||||
assert.False(t, ok, "non-string value must not be reported as string")
|
||||
|
||||
_, ok = p.GetString(KeySetupKey)
|
||||
_, ok = p.GetString(KeyPreSharedKey)
|
||||
assert.False(t, ok, "empty string treated as unset")
|
||||
|
||||
_, ok = p.GetString("nonexistent")
|
||||
|
||||
Reference in New Issue
Block a user