mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-02 03:29:07 +02:00
fix combined server config around sync message versioning
Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
+28
-25
@@ -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
|
||||||
@@ -116,21 +119,19 @@ type SignalConfig struct {
|
|||||||
|
|
||||||
// ManagementConfig contains management service settings
|
// ManagementConfig contains management service settings
|
||||||
type ManagementConfig struct {
|
type ManagementConfig struct {
|
||||||
Enabled bool `yaml:"enabled"`
|
Enabled bool `yaml:"enabled"`
|
||||||
LogLevel string `yaml:"logLevel"`
|
LogLevel string `yaml:"logLevel"`
|
||||||
DataDir string `yaml:"dataDir"`
|
DataDir string `yaml:"dataDir"`
|
||||||
DnsDomain string `yaml:"dnsDomain"`
|
DnsDomain string `yaml:"dnsDomain"`
|
||||||
DisableAnonymousMetrics bool `yaml:"disableAnonymousMetrics"`
|
DisableAnonymousMetrics bool `yaml:"disableAnonymousMetrics"`
|
||||||
DisableGeoliteUpdate bool `yaml:"disableGeoliteUpdate"`
|
DisableGeoliteUpdate bool `yaml:"disableGeoliteUpdate"`
|
||||||
DisableDefaultPolicy bool `yaml:"disableDefaultPolicy"`
|
DisableDefaultPolicy bool `yaml:"disableDefaultPolicy"`
|
||||||
Auth AuthConfig `yaml:"auth"`
|
Auth AuthConfig `yaml:"auth"`
|
||||||
Stuns []HostConfig `yaml:"stuns"`
|
Stuns []HostConfig `yaml:"stuns"`
|
||||||
Relays RelaysConfig `yaml:"relays"`
|
Relays RelaysConfig `yaml:"relays"`
|
||||||
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
|
||||||
@@ -696,16 +697,18 @@ func (c *CombinedConfig) ToManagementConfig() (*nbconfig.Config, error) {
|
|||||||
httpConfig.AuthCallbackURL = callbackURL + types.ProxyCallbackEndpointFull
|
httpConfig.AuthCallbackURL = callbackURL + types.ProxyCallbackEndpointFull
|
||||||
|
|
||||||
return &nbconfig.Config{
|
return &nbconfig.Config{
|
||||||
Stuns: stuns,
|
Stuns: stuns,
|
||||||
Relay: relayConfig,
|
Relay: relayConfig,
|
||||||
Signal: signalConfig,
|
Signal: signalConfig,
|
||||||
Datadir: mgmt.DataDir,
|
Datadir: mgmt.DataDir,
|
||||||
DataStoreEncryptionKey: mgmt.Store.EncryptionKey,
|
DataStoreEncryptionKey: mgmt.Store.EncryptionKey,
|
||||||
HttpConfig: httpConfig,
|
HttpConfig: httpConfig,
|
||||||
StoreConfig: storeConfig,
|
StoreConfig: storeConfig,
|
||||||
ReverseProxy: reverseProxy,
|
ReverseProxy: reverseProxy,
|
||||||
DisableDefaultPolicy: mgmt.DisableDefaultPolicy,
|
DisableDefaultPolicy: mgmt.DisableDefaultPolicy,
|
||||||
EmbeddedIdP: embeddedIdP,
|
EmbeddedIdP: embeddedIdP,
|
||||||
|
SupportedSyncMessageVersions: c.Server.SupportedSyncMessageVersions,
|
||||||
|
PerAccountSupportedSyncMessageVersions: c.Server.PerAccountSupportedSyncMessageVersions,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user