rename alpha option to be more explicit

This commit is contained in:
William Will 2025-08-08 11:29:49 -06:00 committed by Jan Larwig
parent 474d869d2e
commit cbd3b8ccb3
No known key found for this signature in database
GPG Key ID: C2172BFA220A037A
4 changed files with 6 additions and 8 deletions

View File

@ -47,7 +47,7 @@ type AlphaOptions struct {
Providers Providers `json:"providers,omitempty"`
// AWS IAM Options is used to configure IAM authentication for your redis instance.
AWSIAMOptions *AWSIAMOptions `json:"awsIAM,omitempty"`
redisSessionAWSIAMConfig *AWSIAMConfig `json:"redisSessionAWSIAMConfig,omitempty"`
}
// MergeInto replaces alpha options in the Options struct with the values
@ -59,7 +59,7 @@ func (a *AlphaOptions) MergeInto(opts *Options) {
opts.Server = a.Server
opts.MetricsServer = a.MetricsServer
opts.Providers = a.Providers
opts.Session.Redis.AWSIAMConfig = a.AWSIAMOptions
opts.Session.Redis.AWSIAMConfig = a.redisSessionAWSIAMConfig
}
// ExtractFrom populates the fields in the AlphaOptions with the values from
@ -71,5 +71,5 @@ func (a *AlphaOptions) ExtractFrom(opts *Options) {
a.Server = opts.Server
a.MetricsServer = opts.MetricsServer
a.Providers = opts.Providers
a.AWSIAMOptions = opts.Session.Redis.AWSIAMConfig
a.redisSessionAWSIAMConfig = opts.Session.Redis.AWSIAMConfig
}

View File

@ -1,6 +1,6 @@
package options
type AWSIAMOptions struct {
type AWSIAMConfig struct {
// AWS service redis service being used. "elasticache" or "memorydb"
ServiceName string `json:"serviceName,omitempty`
// AWS Cluster name

View File

@ -34,7 +34,7 @@ type RedisStoreOptions struct {
CAPath string `flag:"redis-ca-path" cfg:"redis_ca_path"`
InsecureSkipTLSVerify bool `flag:"redis-insecure-skip-tls-verify" cfg:"redis_insecure_skip_tls_verify"`
IdleTimeout int `flag:"redis-connection-idle-timeout" cfg:"redis_connection_idle_timeout"`
AWSIAMConfig *AWSIAMOptions `cfg:",internal"`
AWSIAMConfig *AWSIAMConfig `cfg:",internal"`
}
func sessionOptionsDefaults() SessionOptions {

View File

@ -288,10 +288,8 @@ var _ = Describe("Redis SessionStore Tests", func() {
opt = &redis.Options{}
err := setupAWSIAMAuth(redisOpts, opt)
Expect(err).ToNot(HaveOccurred())
Expect(opt.CredentialsProvider).ToNot(BeNil())
// Verify the CredentialsProvider returns the expected username
username, _ := opt.CredentialsProvider()
Expect(username).To(Equal("test-user"))
})
@ -304,7 +302,7 @@ var _ = Describe("Redis SessionStore Tests", func() {
opt = &redis.Options{}
err := setupAWSIAMAuth(redisOpts, opt)
Expect(err).ToNot(HaveOccurred())
Expect(opt.CredentialsProvider).To(BeNil())
})
})