diff --git a/.gitignore b/.gitignore index 7ccb625..539ab34 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dll *.so *.dylib +elastop # Test binary, built with `go test -c` *.test diff --git a/elastop b/elastop deleted file mode 100755 index a449b2d..0000000 Binary files a/elastop and /dev/null differ diff --git a/elastop.go b/elastop.go index a03fc7a..653d9d3 100644 --- a/elastop.go +++ b/elastop.go @@ -551,11 +551,6 @@ func main() { os.Exit(1) } - if apiKey == "" && (*user == "" || *password == "") { - fmt.Fprintf(os.Stderr, "Error: Must provide either API key or both username and password\n") - os.Exit(1) - } - // Strip any trailing slash from the host *host = strings.TrimRight(*host, "/") @@ -619,7 +614,7 @@ func main() { // Set authentication if apiKey != "" { req.Header.Set("Authorization", fmt.Sprintf("ApiKey %s", apiKey)) - } else { + } else if *user != "" && *password != "" { req.SetBasicAuth(*user, *password) }