aboutsummaryrefslogtreecommitdiff
path: root/config_forwarder.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-17 14:41:39 +0700
committerShulhan <ms@kilabit.info>2022-08-17 14:41:39 +0700
commita3ea0c7bda6cae7a88af7dd005cd52ac40d42e57 (patch)
tree4733d2ced445af2e87b173207e35c245cf8da32c /config_forwarder.go
parentc28879b9d5f2f1bea96d5aaf64f1af1fc185e7b0 (diff)
downloadhaminer-a3ea0c7bda6cae7a88af7dd005cd52ac40d42e57.tar.xz
all: make the forwarders configuration fields to be generic
Instead of single forwarder, Influxd, the Config struct now can have one or more forwarders. The kind of forwarders is defined by it subsection name, for example `[forwarder "influxd"]` defined a forwarder for influxd.
Diffstat (limited to 'config_forwarder.go')
-rw-r--r--config_forwarder.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/config_forwarder.go b/config_forwarder.go
index 357f562..408d1bd 100644
--- a/config_forwarder.go
+++ b/config_forwarder.go
@@ -10,27 +10,29 @@ const (
influxdVersion1 = `v1`
influxdVersion2 = `v2`
+
+ forwarderInfluxd = `influxd`
)
-// ConfigForwarder contains configuration for forwarding the logs to Influxd.
+// ConfigForwarder contains configuration for forwarding the logs.
type ConfigForwarder struct {
- Version string `ini:"forwarder:influxd:version"`
+ Version string `ini:"::version"`
- Url string `ini:"forwarder:influxd:url"`
+ Url string `ini:"::url"`
apiWrite string
headerToken string
- Bucket string `ini:"forwarder:influxd:bucket"`
+ Bucket string `ini:"::bucket"`
// Fields for HTTP API v1.
- User string `ini:"forwarder:influxd:user"`
- Pass string `ini:"forwarder:influxd:pass"`
+ User string `ini:"::user"`
+ Pass string `ini:"::pass"`
// Fields for HTTP API v2.
- Org string `ini:"forwarder:influxd:org"`
- Token string `ini:"forwarder:influxd:token"`
+ Org string `ini:"::org"`
+ Token string `ini:"::token"`
}
// init check, validate, and initialize the configuration values.