Skip to content

Commit

Permalink
Return default config via function call
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Mar 5, 2020
1 parent 9de9b87 commit 63664e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libbeat/esleg/eslegclient/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ type config struct {
Timeout time.Duration `config:"timeout"`
}

var (
defaultConfig = config{
func defaultConfig() config {
return config{
Protocol: "",
Path: "",
ProxyURL: "",
Expand All @@ -61,7 +61,7 @@ var (
EscapeHTML: false,
TLS: nil,
}
)
}

func (c *config) Validate() error {
if c.ProxyURL != "" && !c.ProxyDisable {
Expand Down
2 changes: 1 addition & 1 deletion libbeat/esleg/eslegclient/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func NewConnection(s ConnectionSettings) (*Connection, error) {
// output, except for the output specific configuration options. If multiple hosts
// are defined in the configuration, a client is returned for each of them.
func NewClients(cfg *common.Config) ([]Connection, error) {
config := defaultConfig
config := defaultConfig()
if err := cfg.Unpack(&config); err != nil {
return nil, err
}
Expand Down

0 comments on commit 63664e5

Please sign in to comment.