diff --git a/internal/config/config.go b/internal/config/config.go index 689e9434d..37c500cb7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -105,10 +105,6 @@ type Config struct { UnifiedProxy configtypes.UnifiedProxy `mapstructure:"unified_proxy" json:"unified_proxy" envconfig:"unified_proxy"` // Proxies is a configuration for granular events proxies. See also UnifiedProxy. Proxies configtypes.Proxies `mapstructure:"proxies" json:"proxies" envconfig:"proxies"` - // ConnectProxyName is a name of proxy to use for connect events. When not set connect events are not proxied. - ConnectProxyName string `mapstructure:"connect_proxy_name" json:"connect_proxy_name" envconfig:"connect_proxy_name"` - // RefreshProxyName is a name of proxy to use for refresh events. When not set refresh events are not proxied. - RefreshProxyName string `mapstructure:"refresh_proxy_name" json:"refresh_proxy_name" envconfig:"refresh_proxy_name"` // OpenTelemetry is a configuration for OpenTelemetry tracing. OpenTelemetry configtypes.OpenTelemetry `mapstructure:"opentelemetry" json:"opentelemetry" envconfig:"opentelemetry"` diff --git a/internal/config/validate.go b/internal/config/validate.go index c1a4037c8..8cb3cdc20 100644 --- a/internal/config/validate.go +++ b/internal/config/validate.go @@ -44,17 +44,17 @@ func (c Config) Validate() error { proxyNames = append(proxyNames, UnifiedProxyName) // channel options can use global proxy name. - if c.ConnectProxyName != "" && !slices.Contains(proxyNames, c.ConnectProxyName) { - return fmt.Errorf("proxy %s not found for connect", c.ConnectProxyName) + if c.Client.ConnectProxyName != "" && !slices.Contains(proxyNames, c.Client.ConnectProxyName) { + return fmt.Errorf("proxy %s not found for connect", c.Client.ConnectProxyName) } - if c.RefreshProxyName != "" && !slices.Contains(proxyNames, c.RefreshProxyName) { - return fmt.Errorf("proxy %s not found for refresh", c.RefreshProxyName) + if c.Client.RefreshProxyName != "" && !slices.Contains(proxyNames, c.Client.RefreshProxyName) { + return fmt.Errorf("proxy %s not found for refresh", c.Client.RefreshProxyName) } - if c.ConnectProxyName == UnifiedProxyName && c.UnifiedProxy.ConnectEndpoint == "" { - return fmt.Errorf("no connect_endpoint set for unified_proxy, can't use `%s` proxy name for connect proxy", UnifiedProxyName) + if c.Client.ConnectProxyName == UnifiedProxyName && c.UnifiedProxy.ConnectEndpoint == "" { + return fmt.Errorf("no connect_endpoint set for unified_proxy, can't use `%s` proxy name for client connect proxy", UnifiedProxyName) } - if c.RefreshProxyName == UnifiedProxyName && c.UnifiedProxy.RefreshEndpoint == "" { - return fmt.Errorf("no refresh_endpoint set for unified_proxy, can't use `%s` proxy name for refresh proxy", UnifiedProxyName) + if c.Client.RefreshProxyName == UnifiedProxyName && c.UnifiedProxy.RefreshEndpoint == "" { + return fmt.Errorf("no refresh_endpoint set for unified_proxy, can't use `%s` proxy name for client refresh proxy", UnifiedProxyName) } if err := validateSecondPrecisionDuration(c.Channel.HistoryMetaTTL); err != nil { return fmt.Errorf("in channel.history_meta_ttl: %v", err) diff --git a/internal/configtypes/types.go b/internal/configtypes/types.go index 202cd943b..0d1578f9f 100644 --- a/internal/configtypes/types.go +++ b/internal/configtypes/types.go @@ -292,6 +292,11 @@ type Shutdown struct { } type Client struct { + // ConnectProxyName is a name of proxy to use for connect events. When not set connect events are not proxied. + ConnectProxyName string `mapstructure:"connect_proxy_name" json:"connect_proxy_name" envconfig:"connect_proxy_name"` + // RefreshProxyName is a name of proxy to use for refresh events. When not set refresh events are not proxied. + RefreshProxyName string `mapstructure:"refresh_proxy_name" json:"refresh_proxy_name" envconfig:"refresh_proxy_name"` + // AllowedOrigins is a list of allowed origins for client connections. AllowedOrigins []string `mapstructure:"allowed_origins" json:"allowed_origins" envconfig:"allowed_origins"` diff --git a/internal/runutil/proxy.go b/internal/runutil/proxy.go index b78e69c5f..95775a5d2 100644 --- a/internal/runutil/proxy.go +++ b/internal/runutil/proxy.go @@ -35,7 +35,7 @@ func buildProxyMap(cfg config.Config) (*client.ProxyMap, bool) { var keepHeadersInContext bool - connectProxyName := cfg.ConnectProxyName + connectProxyName := cfg.Client.ConnectProxyName if connectProxyName != "" { var p proxy.Config if connectProxyName == config.UnifiedProxyName { @@ -58,7 +58,7 @@ func buildProxyMap(cfg config.Config) (*client.ProxyMap, bool) { keepHeadersInContext = true } - refreshProxyName := cfg.RefreshProxyName + refreshProxyName := cfg.Client.RefreshProxyName if refreshProxyName != "" { var p proxy.Config if refreshProxyName == config.UnifiedProxyName {