Skip to content

Commit

Permalink
various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Nov 13, 2024
1 parent 83e5846 commit faf559f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/configtypes/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ type Redis struct {
ClientName string `mapstructure:"client_name" json:"client_name" envconfig:"client_name" yaml:"client_name" toml:"client_name"`
ForceResp2 bool `mapstructure:"force_resp2" json:"force_resp2" envconfig:"force_resp2" yaml:"force_resp2" toml:"force_resp2"`
ClusterAddress []string `mapstructure:"cluster_address" json:"cluster_address" envconfig:"cluster_address" yaml:"cluster_address" toml:"cluster_address"`
TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"`
SentinelAddress []string `mapstructure:"sentinel_address" json:"sentinel_address" envconfig:"sentinel_address" yaml:"sentinel_address" toml:"sentinel_address"`
SentinelUser string `mapstructure:"sentinel_user" json:"sentinel_user" envconfig:"sentinel_user" yaml:"sentinel_user" toml:"sentinel_user"`
SentinelPassword string `mapstructure:"sentinel_password" json:"sentinel_password" envconfig:"sentinel_password" yaml:"sentinel_password" toml:"sentinel_password"`
SentinelMasterName string `mapstructure:"sentinel_master_name" json:"sentinel_master_name" envconfig:"sentinel_master_name" yaml:"sentinel_master_name" toml:"sentinel_master_name"`
SentinelClientName string `mapstructure:"sentinel_client_name" json:"sentinel_client_name" envconfig:"sentinel_client_name" yaml:"sentinel_client_name" toml:"sentinel_client_name"`
TLS TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" yaml:"tls" toml:"tls"`
SentinelTLS TLSConfig `mapstructure:"sentinel_tls" json:"sentinel_tls" envconfig:"sentinel_tls" yaml:"sentinel_tls" toml:"sentinel_tls"`
}
2 changes: 1 addition & 1 deletion internal/configtypes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ type ProxyCommonHTTP struct {
// both have priority over values set in StaticHttpHeaders map.
StaticHeaders MapStringString `mapstructure:"static_headers" default:"{}" json:"static_headers" envconfig:"static_headers" yaml:"static_headers" toml:"static_headers"`
// Status transforms allow to map HTTP status codes from proxy to Disconnect or Error messages.
StatusToCodeTransforms HttpStatusToCodeTransforms `mapstructure:"status_to_code_transforms" default:"[]" json:"status_to_code_transforms,omitempty" envconfig:"status_to_code_transforms" yaml:"status_to_code_transforms" toml:"status_to_code_transforms"`
StatusToCodeTransforms HttpStatusToCodeTransforms `mapstructure:"status_to_code_transforms" default:"[]" json:"status_to_code_transforms" envconfig:"status_to_code_transforms" yaml:"status_to_code_transforms" toml:"status_to_code_transforms"`
}

type ProxyCommonGRPC struct {
Expand Down
4 changes: 3 additions & 1 deletion internal/proxy/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ func requestHeaders(ctx context.Context, allowedHeaders []string, allowedMetaKey
headers.Set(k, v)
}
for k, v := range emulatedHeaders {
headers.Set(k, v)
if slices.Contains(allowedHeaders, strings.ToLower(k)) {
headers.Set(k, v)
}
}
headers.Set("Content-Type", "application/json")
md, _ := metadata.FromIncomingContext(ctx)
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ func mustGenerateSecretKey(byteLen int) string {
if _, err := rand.Read(key); err != nil {
panic(err)
}
return base64.RawStdEncoding.EncodeToString(key)
return base64.RawURLEncoding.EncodeToString(key)
}

0 comments on commit faf559f

Please sign in to comment.