mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-02 03:46:29 +02:00
35 lines
618 B
Go
35 lines
618 B
Go
package redis
|
|
|
|
import (
|
|
"crypto/tls"
|
|
)
|
|
|
|
type dbConfig struct {
|
|
tls *tls.Config
|
|
recordType string
|
|
}
|
|
|
|
// Option customizes a DB.
|
|
type Option func(*dbConfig)
|
|
|
|
// WithRecordType sets the record type in the config.
|
|
func WithRecordType(recordType string) Option {
|
|
return func(cfg *dbConfig) {
|
|
cfg.recordType = recordType
|
|
}
|
|
}
|
|
|
|
// WithTLSConfig sets the tls.Config which DB uses.
|
|
func WithTLSConfig(tlsConfig *tls.Config) Option {
|
|
return func(cfg *dbConfig) {
|
|
cfg.tls = tlsConfig
|
|
}
|
|
}
|
|
|
|
func getConfig(options ...Option) *dbConfig {
|
|
cfg := new(dbConfig)
|
|
for _, o := range options {
|
|
o(cfg)
|
|
}
|
|
return cfg
|
|
}
|