fix combined server config around sync message versioning

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
Dmitri Dolguikh
2026-07-14 14:54:39 +02:00
parent 28d8a19331
commit 4d1d7edbc9
2 changed files with 30 additions and 27 deletions
+5 -2
View File
@@ -74,6 +74,9 @@ type ServerConfig struct {
ActivityStore StoreConfig `yaml:"activityStore"` ActivityStore StoreConfig `yaml:"activityStore"`
AuthStore StoreConfig `yaml:"authStore"` AuthStore StoreConfig `yaml:"authStore"`
ReverseProxy ReverseProxyConfig `yaml:"reverseProxy"` ReverseProxy ReverseProxyConfig `yaml:"reverseProxy"`
SupportedSyncMessageVersions []string `yaml:"supportedSyncMessageVersions"`
PerAccountSupportedSyncMessageVersions map[string][]string `yaml:"perAccountSupportedSyncMessageVersions"`
} }
// TLSConfig contains TLS/HTTPS settings // TLSConfig contains TLS/HTTPS settings
@@ -129,8 +132,6 @@ type ManagementConfig struct {
SignalURI string `yaml:"signalUri"` SignalURI string `yaml:"signalUri"`
Store StoreConfig `yaml:"store"` Store StoreConfig `yaml:"store"`
ReverseProxy ReverseProxyConfig `yaml:"reverseProxy"` ReverseProxy ReverseProxyConfig `yaml:"reverseProxy"`
SupportedSyncMessageVersions []string `yaml:"supportedSyncMessageVersions"`
PerAccountSupportedSyncMessageVersions map[string][]string `yaml:"perAccountSupportedSyncMessageVersions"`
} }
// AuthConfig contains authentication/identity provider settings // AuthConfig contains authentication/identity provider settings
@@ -706,6 +707,8 @@ func (c *CombinedConfig) ToManagementConfig() (*nbconfig.Config, error) {
ReverseProxy: reverseProxy, ReverseProxy: reverseProxy,
DisableDefaultPolicy: mgmt.DisableDefaultPolicy, DisableDefaultPolicy: mgmt.DisableDefaultPolicy,
EmbeddedIdP: embeddedIdP, EmbeddedIdP: embeddedIdP,
SupportedSyncMessageVersions: c.Server.SupportedSyncMessageVersions,
PerAccountSupportedSyncMessageVersions: c.Server.PerAccountSupportedSyncMessageVersions,
}, nil }, nil
} }
+2 -2
View File
@@ -506,11 +506,11 @@ func createManagementServer(cfg *CombinedConfig, mgmtConfig *nbconfig.Config) (m
} }
mgmtPort, _ := strconv.Atoi(portStr) mgmtPort, _ := strconv.Atoi(portStr)
if err := syncgrpc.ValidateSyncMessageVersions(cfg.Management.SupportedSyncMessageVersions); err != nil { if err := syncgrpc.ValidateSyncMessageVersions(mgmtConfig.SupportedSyncMessageVersions); err != nil {
return nil, err return nil, err
} }
for accountId, versions := range cfg.Management.PerAccountSupportedSyncMessageVersions { for accountId, versions := range mgmtConfig.PerAccountSupportedSyncMessageVersions {
if err := syncgrpc.ValidateSyncMessageVersions(versions); err != nil { if err := syncgrpc.ValidateSyncMessageVersions(versions); err != nil {
return nil, fmt.Errorf("unrecognized sync message version in perAccountSupportedSyncMessageVersions for account %s %w", accountId, err) return nil, fmt.Errorf("unrecognized sync message version in perAccountSupportedSyncMessageVersions for account %s %w", accountId, err)
} }