Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/elasticsearch] Initialize Component #6827

Merged
merged 12 commits into from
Dec 17, 2021
Prev Previous commit
Next Next commit
Move constants to top of config.go
  • Loading branch information
BinaryFissionGames committed Dec 16, 2021
commit 304f2b30b9d66415f6a13845d2978042e2c40bb7
20 changes: 10 additions & 10 deletions receiver/elasticsearchreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ import (
"go.uber.org/multierr"
)

// Config is the configuration for the elasticsearch receiver
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
confighttp.HTTPClientSettings `mapstructure:",squash"`
// Username is the username used when making REST calls to elasticsearch. Must be specified if Password is. Not required.
Username string `mapstructure:"username"`
// Password is the password used when making REST calls to elasticsearch. Must be specified if Username is. Not required.
Password string `mapstructure:"password"`
}

var (
defaultEndpoint = "https://localhost:9200"
)
Expand All @@ -50,6 +40,16 @@ var validSchemes = []string{
"https",
}

// Config is the configuration for the elasticsearch receiver
type Config struct {
scraperhelper.ScraperControllerSettings `mapstructure:",squash"`
confighttp.HTTPClientSettings `mapstructure:",squash"`
// Username is the username used when making REST calls to elasticsearch. Must be specified if Password is. Not required.
Username string `mapstructure:"username"`
// Password is the password used when making REST calls to elasticsearch. Must be specified if Username is. Not required.
Password string `mapstructure:"password"`
}

// Validate validates the given config, returning an error specifying any issues with the config.
func (cfg *Config) Validate() error {
var combinedErr error
Expand Down