Skip to content

Commit

Permalink
Merge pull request elastic#253 from monicasarbu/set_defaultscheme_http
Browse files Browse the repository at this point in the history
Set default scheme to http
  • Loading branch information
ruflin committed Nov 3, 2015
2 parents 5a5d4d0 + 9e98415 commit 2ac5744
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file based on the
- Limit number of workers for Elasticsearch output. elastic/packetbeat#226
- On Windows, remove service related error message when running in the console. #242
- Fix waitRetry no configured in single output mode configuration. elastic/filebeat#144
- Use http as the default scheme in the elasticsearch hosts #253

### Added
- Add Console output plugin. #218
Expand Down
5 changes: 5 additions & 0 deletions outputs/elasticsearch/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (
// Creates the url based on the url configuration.
// Adds missing parts with defaults (scheme, host, port)
func getURL(defaultScheme string, defaultPath string, rawURL string) (string, error) {

if defaultScheme == "" {
defaultScheme = "http"
}

addr, err := url.Parse(rawURL)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion outputs/elasticsearch/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestGetUrl(t *testing.T) {
}

for input, output := range inputOutput {
urlNew, err := getURL("http", "", input)
urlNew, err := getURL("", "", input)
assert.Nil(t, err)
assert.Equal(t, output, urlNew, fmt.Sprintf("input: %v", input))
}
Expand Down

0 comments on commit 2ac5744

Please sign in to comment.