Skip to content

Commit 64c2bc4

Browse files
authored
Merge pull request #50 from Icinga/redis-db-config
redis: Configurable Database
2 parents ee07796 + 7d47808 commit 64c2bc4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

redis/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func NewClientFromConfig(c *Config, logger *logging.Logger) (*Client, error) {
5353
options := &redis.Options{
5454
Dialer: dialWithLogging(dialer, logger),
5555
Password: c.Password,
56-
DB: 0, // Use default DB,
56+
DB: c.Database,
5757
ReadTimeout: c.Options.Timeout,
5858
TLSConfig: tlsConfig,
5959
}

redis/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type Config struct {
4545
Host string `yaml:"host"`
4646
Port int `yaml:"port"`
4747
Password string `yaml:"password"`
48+
Database int `yaml:"database" default:"0"`
4849
TlsOptions config.TLS `yaml:",inline"`
4950
Options Options `yaml:"options"`
5051
}

0 commit comments

Comments
 (0)