new
This commit is contained in:
parent
c3dd546952
commit
69bd724000
1 changed files with 2 additions and 6 deletions
|
@ -32,14 +32,10 @@ func (KeyDBHandler) CaddyModule() caddy.ModuleInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *KeyDBHandler) Provision(ctx caddy.Context) error {
|
func (h *KeyDBHandler) Provision(ctx caddy.Context) error {
|
||||||
db, err := strconv.Atoi(h.DB)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("invalid db value: %v", err)
|
|
||||||
}
|
|
||||||
h.client = redis.NewClient(&redis.Options{
|
h.client = redis.NewClient(&redis.Options{
|
||||||
Addr: h.Address,
|
Addr: h.Address,
|
||||||
Password: h.Password,
|
Password: h.Password,
|
||||||
DB: db,
|
DB: h.DB,
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -80,7 +76,7 @@ func (h *KeyDBHandler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
return d.ArgErr()
|
return d.ArgErr()
|
||||||
}
|
}
|
||||||
case "db":
|
case "db":
|
||||||
if !d.Args(&h.DB) {
|
if !d.Args(strconv.Atoi(&h.DB)) {
|
||||||
return d.ArgErr()
|
return d.ArgErr()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue