Skip to content

Commit

Permalink
chore: Generate config at build time (influxdata#12766)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Mar 1, 2023
1 parent 3a0a9f0 commit e6e22f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10,751 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.idea
/build
/etc/telegraf.conf
/telegraf
/telegraf.exe
/telegraf.gz
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ all: deps docs telegraf
help:
@echo 'Targets:'
@echo ' all - download dependencies and compile telegraf binary'
@echo ' config - generate the config from current repo state'
@echo ' deps - download dependencies'
@echo ' docs - embed sample-configurations into READMEs'
@echo ' telegraf - compile telegraf binary'
Expand Down Expand Up @@ -117,6 +118,11 @@ embed_readme_%:
GOOS=windows go generate -run="readme_config_includer/generator$$" ./plugins/$*/...
GOOS=darwin go generate -run="readme_config_includer/generator$$" ./plugins/$*/...

.PHONY: config
config:
@echo "generating default config"
go run ./cmd/telegraf config > etc/telegraf.conf

.PHONY: docs
docs: build_tools embed_readme_inputs embed_readme_outputs embed_readme_processors embed_readme_aggregators embed_readme_secretstores

Expand Down Expand Up @@ -218,6 +224,7 @@ check-deps:
clean:
rm -f telegraf
rm -f telegraf.exe
rm -f etc/telegraf.conf
rm -rf build
rm -rf cmd/telegraf/resource.syso
rm -rf cmd/telegraf/versioninfo.json
Expand Down Expand Up @@ -327,7 +334,7 @@ darwin-arm64:
include_packages := $(mips) $(mipsel) $(arm64) $(amd64) $(armel) $(armhf) $(riscv64) $(s390x) $(ppc64le) $(i386) $(windows) $(darwin-amd64) $(darwin-arm64)

.PHONY: package
package: docs $(include_packages)
package: docs config $(include_packages)

.PHONY: $(include_packages)
$(include_packages):
Expand Down
Loading

0 comments on commit e6e22f0

Please sign in to comment.