dashboard/cache/uriparser.go
2020-04-02 20:53:11 +01:00

22 lines
314 B
Go

package cache
import "net/url"
type RedisURI struct {
Addr string
Password string
}
func ParseURI(raw string) RedisURI {
parsed, err := url.Parse(raw); if err != nil {
panic(err)
}
passwd, _ := parsed.User.Password()
return RedisURI{
Addr: parsed.Host,
Password: passwd,
}
}