Merge pull request #2471 from GarageDeveloper/master

fixes #2249: sanitize tenant and tenantid
This commit is contained in:
Stephen Day 2018-02-02 16:29:34 -08:00 committed by GitHub
commit fea8bd5114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -142,6 +142,19 @@ func FromParameters(parameters map[string]interface{}) (*Driver, error) {
InsecureSkipVerify: false, InsecureSkipVerify: false,
} }
// Sanitize some entries before trying to decode parameters with mapstructure
// TenantID and Tenant when integers only and passed as ENV variables
// are considered as integer and not string. The parser fails in this
// case.
_, ok := parameters["tenant"]
if ok {
parameters["tenant"] = fmt.Sprint(parameters["tenant"])
}
_, ok = parameters["tenantid"]
if ok {
parameters["tenantid"] = fmt.Sprint(parameters["tenantid"])
}
if err := mapstructure.Decode(parameters, &params); err != nil { if err := mapstructure.Decode(parameters, &params); err != nil {
return nil, err return nil, err
} }