Allow no auth connections
This commit is contained in:
parent
23a7c216ab
commit
4bbf0c6bf1
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
elastop
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user