diff options
| author | Shulhan <ms@kilabit.info> | 2022-08-17 14:41:39 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-08-17 14:41:39 +0700 |
| commit | a3ea0c7bda6cae7a88af7dd005cd52ac40d42e57 (patch) | |
| tree | 4733d2ced445af2e87b173207e35c245cf8da32c /config_test.go | |
| parent | c28879b9d5f2f1bea96d5aaf64f1af1fc185e7b0 (diff) | |
| download | haminer-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_test.go')
| -rw-r--r-- | config_test.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/config_test.go b/config_test.go index 779c59a..244bfa6 100644 --- a/config_test.go +++ b/config_test.go @@ -57,13 +57,15 @@ func TestLoad(t *testing.T) { desc: "With path exist", in: "testdata/haminer.conf", exp: &Config{ - Influxd: ConfigForwarder{ - Version: `v2`, - Url: `http://127.0.0.1:8086`, - Org: `kilabit.info`, - Bucket: `haproxy`, - apiWrite: `http://127.0.0.1:8086/api/v2/write?bucket=haproxy&org=kilabit.info&precision=ns`, - headerToken: `Token `, + Forwarders: map[string]*ConfigForwarder{ + `influxd`: &ConfigForwarder{ + Version: `v2`, + Url: `http://127.0.0.1:8086`, + Org: `kilabit.info`, + Bucket: `haproxy`, + apiWrite: `http://127.0.0.1:8086/api/v2/write?bucket=haproxy&org=kilabit.info&precision=ns`, + headerToken: `Token `, + }, }, Listen: `0.0.0.0:8080`, listenAddr: `0.0.0.0`, |
