Allow no auth connections

This commit is contained in:
Dionysus 2024-12-09 15:30:18 -05:00
parent 23a7c216ab
commit 4bbf0c6bf1
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
3 changed files with 2 additions and 6 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
elastop
# Test binary, built with `go test -c`
*.test

BIN
elastop

Binary file not shown.

View File

@ -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)
}