Skip to content

Commit

Permalink
Expose libbeat version in generated beats (#6345)
Browse files Browse the repository at this point in the history
* set libbeat version

* don't shadow config import

* switch cfg var per feedback

cfg is normally used to represent go-ucfg / common.Config
  • Loading branch information
graphaelli authored and ruflin committed Feb 13, 2018
1 parent d21decb commit 6356943
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions generator/beat/{beat}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ES_BEATS?=./vendor/github.com/elastic/beats
GOPACKAGES=$(shell govendor list -no-status +local)
PREFIX?=.
NOTICE_FILE=NOTICE
GOBUILD_FLAGS=-i -ldflags "-X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.buildTime=$(NOW) -X $(BEAT_PATH)/vendor/github.com/elastic/beats/libbeat/version.commit=$(COMMIT_ID)"

# Path to the libbeat Makefile
-include $(ES_BEATS)/libbeat/scripts/Makefile
Expand Down
6 changes: 3 additions & 3 deletions generator/beat/{beat}/beater/{beat}.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ type {Beat} struct {

// Creates beater
func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) {
config := config.DefaultConfig
if err := cfg.Unpack(&config); err != nil {
c := config.DefaultConfig
if err := cfg.Unpack(&c); err != nil {
return nil, fmt.Errorf("Error reading config file: %v", err)
}

bt := &{Beat}{
done: make(chan struct{}),
config: config,
config: c,
}
return bt, nil
}
Expand Down

0 comments on commit 6356943

Please sign in to comment.