Use url.UserPassword() so passwords are escaped (#101)

* add Dockerfile

* dockerfile: switch to multi-stage build to lighten up the final image

* dockerfile: update to latest images, and update the 2nd stage image on build

* Use url.UserPassword() so passwords are escaped
This commit is contained in:
Andy Cobaugh 2020-04-01 08:15:04 -04:00 committed by GitHub
parent 88b072f48e
commit dac91ccd2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -110,7 +110,8 @@ func (vcenter *VCenter) Connect() error {
defer cancel()
stdlog.Println("Connecting to vcenter:", vcenter.Hostname)
u, err := url.Parse("https://" + vcenter.Username + ":" + vcenter.Password + "@" + vcenter.Hostname + "/sdk")
u, err := url.Parse("https://" + vcenter.Hostname + "/sdk")
u.User = url.UserPassword(vcenter.Username, vcenter.Password)
if err != nil {
errlog.Println("Could not parse vcenter url:", vcenter.Hostname)
errlog.Println("Error:", err)