From a3ea0c7bda6cae7a88af7dd005cd52ac40d42e57 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 17 Aug 2022 14:41:39 +0700 Subject: 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. --- config_forwarder.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'config_forwarder.go') 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. -- cgit v1.3