mongodb secret backend: Parse ssl URI option as a boolean rather than relying on string comparison

This commit is contained in:
Matt Hurne 2016-07-01 13:55:06 -04:00
parent 46bf080409
commit cdde4071d7

View file

@ -55,7 +55,11 @@ func parseMongoURI(rawUri string) (*mgo.DialInfo, error) {
}
info.PoolLimit = poolLimit
case "ssl":
if value == "true" {
ssl, err := strconv.ParseBool(value)
if err != nil {
return nil, errors.New("bad value for ssl: " + value)
}
if ssl {
info.DialServer = func(addr *mgo.ServerAddr) (net.Conn, error) {
return tls.Dial("tcp", addr.String(), &tls.Config{})
}