You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-12-01 22:51:45 +02:00
Rename Session Options to improve structure
This commit is contained in:
@@ -40,7 +40,7 @@ type SessionStore struct {
|
||||
// NewRedisSessionStore initialises a new instance of the SessionStore from
|
||||
// the configuration given
|
||||
func NewRedisSessionStore(opts *options.SessionOptions, cookieOpts *options.CookieOptions) (sessions.SessionStore, error) {
|
||||
client, err := newRedisCmdable(opts.RedisStoreOptions)
|
||||
client, err := newRedisCmdable(opts.Redis)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error constructing redis client: %v", err)
|
||||
}
|
||||
@@ -74,16 +74,16 @@ func newRedisCmdable(opts options.RedisStoreOptions) (Client, error) {
|
||||
return newClusterClient(client), nil
|
||||
}
|
||||
|
||||
opt, err := redis.ParseURL(opts.RedisConnectionURL)
|
||||
opt, err := redis.ParseURL(opts.ConnectionURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse redis url: %s", err)
|
||||
}
|
||||
|
||||
if opts.RedisInsecureTLS {
|
||||
if opts.InsecureSkipTLSVerify {
|
||||
opt.TLSConfig.InsecureSkipVerify = true
|
||||
}
|
||||
|
||||
if opts.RedisCAPath != "" {
|
||||
if opts.CAPath != "" {
|
||||
rootCAs, err := x509.SystemCertPool()
|
||||
if err != nil {
|
||||
logger.Printf("failed to load system cert pool for redis connection, falling back to empty cert pool")
|
||||
@@ -91,9 +91,9 @@ func newRedisCmdable(opts options.RedisStoreOptions) (Client, error) {
|
||||
if rootCAs == nil {
|
||||
rootCAs = x509.NewCertPool()
|
||||
}
|
||||
certs, err := ioutil.ReadFile(opts.RedisCAPath)
|
||||
certs, err := ioutil.ReadFile(opts.CAPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load %q, %v", opts.RedisCAPath, err)
|
||||
return nil, fmt.Errorf("failed to load %q, %v", opts.CAPath, err)
|
||||
}
|
||||
|
||||
// Append our cert to the system pool
|
||||
|
||||
@@ -428,7 +428,7 @@ var _ = Describe("NewSessionStore", func() {
|
||||
mr, err = miniredis.Run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
opts.Type = options.RedisSessionStoreType
|
||||
opts.RedisConnectionURL = "redis://" + mr.Addr()
|
||||
opts.Redis.ConnectionURL = "redis://" + mr.Addr()
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
||||
Reference in New Issue
Block a user