mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
chore: add redis username
This commit is contained in:
parent
bda90ac732
commit
f90b2cde71
@ -28,6 +28,7 @@ type Config struct {
|
|||||||
// Redis connection options
|
// Redis connection options
|
||||||
RedisAddr string
|
RedisAddr string
|
||||||
RedisDB int
|
RedisDB int
|
||||||
|
RedisUsername string
|
||||||
RedisPassword string
|
RedisPassword string
|
||||||
RedisTLS string
|
RedisTLS string
|
||||||
RedisURL string
|
RedisURL string
|
||||||
@ -62,6 +63,7 @@ func parseFlags(progname string, args []string) (cfg *Config, output string, err
|
|||||||
flags.IntVar(&conf.Port, "port", getEnvOrDefaultInt("PORT", 8080), "port number to use for web ui server")
|
flags.IntVar(&conf.Port, "port", getEnvOrDefaultInt("PORT", 8080), "port number to use for web ui server")
|
||||||
flags.StringVar(&conf.RedisAddr, "redis-addr", getEnvDefaultString("REDIS_ADDR", "127.0.0.1:6379"), "address of redis server to connect to")
|
flags.StringVar(&conf.RedisAddr, "redis-addr", getEnvDefaultString("REDIS_ADDR", "127.0.0.1:6379"), "address of redis server to connect to")
|
||||||
flags.IntVar(&conf.RedisDB, "redis-db", getEnvOrDefaultInt("REDIS_DB", 0), "redis database number")
|
flags.IntVar(&conf.RedisDB, "redis-db", getEnvOrDefaultInt("REDIS_DB", 0), "redis database number")
|
||||||
|
flags.StringVar(&conf.RedisUsername, "redis-username", getEnvDefaultString("REDIS_USERNAME", ""), "username to use when connecting to redis server")
|
||||||
flags.StringVar(&conf.RedisPassword, "redis-password", getEnvDefaultString("REDIS_PASSWORD", ""), "password to use when connecting to redis server")
|
flags.StringVar(&conf.RedisPassword, "redis-password", getEnvDefaultString("REDIS_PASSWORD", ""), "password to use when connecting to redis server")
|
||||||
flags.StringVar(&conf.RedisTLS, "redis-tls", getEnvDefaultString("REDIS_TLS", ""), "server name for TLS validation used when connecting to redis server")
|
flags.StringVar(&conf.RedisTLS, "redis-tls", getEnvDefaultString("REDIS_TLS", ""), "server name for TLS validation used when connecting to redis server")
|
||||||
flags.StringVar(&conf.RedisURL, "redis-url", getEnvDefaultString("REDIS_URL", ""), "URL to redis server")
|
flags.StringVar(&conf.RedisURL, "redis-url", getEnvDefaultString("REDIS_URL", ""), "URL to redis server")
|
||||||
@ -96,6 +98,7 @@ func makeRedisConnOpt(cfg *Config) (asynq.RedisConnOpt, error) {
|
|||||||
if len(cfg.RedisClusterNodes) > 0 {
|
if len(cfg.RedisClusterNodes) > 0 {
|
||||||
return asynq.RedisClusterClientOpt{
|
return asynq.RedisClusterClientOpt{
|
||||||
Addrs: strings.Split(cfg.RedisClusterNodes, ","),
|
Addrs: strings.Split(cfg.RedisClusterNodes, ","),
|
||||||
|
Username: cfg.RedisUsername,
|
||||||
Password: cfg.RedisPassword,
|
Password: cfg.RedisPassword,
|
||||||
TLSConfig: makeTLSConfig(cfg),
|
TLSConfig: makeTLSConfig(cfg),
|
||||||
}, nil
|
}, nil
|
||||||
@ -123,6 +126,7 @@ func makeRedisConnOpt(cfg *Config) (asynq.RedisConnOpt, error) {
|
|||||||
} else {
|
} else {
|
||||||
connOpt.Addr = cfg.RedisAddr
|
connOpt.Addr = cfg.RedisAddr
|
||||||
connOpt.DB = cfg.RedisDB
|
connOpt.DB = cfg.RedisDB
|
||||||
|
connOpt.Username = cfg.RedisUsername
|
||||||
connOpt.Password = cfg.RedisPassword
|
connOpt.Password = cfg.RedisPassword
|
||||||
}
|
}
|
||||||
if connOpt.TLSConfig == nil {
|
if connOpt.TLSConfig == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user