Support env overrides for all inputs of the same type
parent
6f5c72e6ea
commit
d983a8c0d3
|
@ -7,6 +7,7 @@
|
|||
- [#6228](https://github.com/influxdata/influxdb/pull/6228): Support for multiple listeners for collectd and OpenTSDB inputs.
|
||||
- [#6292](https://github.com/influxdata/influxdb/issues/6292): Allow percentile to be used as a selector.
|
||||
- [#5707](https://github.com/influxdata/influxdb/issues/5707): Return a deprecated message when IF NOT EXISTS is used.
|
||||
- [#6334](https://github.com/influxdata/influxdb/pull/6334): Allow environment variables to be set per input type.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
|
|
@ -175,6 +175,9 @@ func (c *Config) applyEnvOverrides(prefix string, spec reflect.Value) error {
|
|||
// e.g. GRAPHITE_0
|
||||
if f.Kind() == reflect.Slice || f.Kind() == reflect.Array {
|
||||
for i := 0; i < f.Len(); i++ {
|
||||
if err := c.applyEnvOverrides(key, f.Index(i)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.applyEnvOverrides(fmt.Sprintf("%s_%d", key, i), f.Index(i)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -141,6 +141,8 @@ bind-address = ":2010"
|
|||
[[udp]]
|
||||
bind-address = ":4444"
|
||||
|
||||
[[udp]]
|
||||
|
||||
[monitoring]
|
||||
enabled = true
|
||||
|
||||
|
@ -154,6 +156,10 @@ enabled = true
|
|||
t.Fatalf("failed to set env var: %v", err)
|
||||
}
|
||||
|
||||
if err := os.Setenv("INFLUXDB_UDP_0_BIND_ADDRESS", ":5555"); err != nil {
|
||||
t.Fatalf("failed to set env var: %v", err)
|
||||
}
|
||||
|
||||
if err := os.Setenv("INFLUXDB_GRAPHITE_1_PROTOCOL", "udp"); err != nil {
|
||||
t.Fatalf("failed to set env var: %v", err)
|
||||
}
|
||||
|
@ -170,10 +176,14 @@ enabled = true
|
|||
t.Fatalf("failed to apply env overrides: %v", err)
|
||||
}
|
||||
|
||||
if c.UDPInputs[0].BindAddress != ":4444" {
|
||||
if c.UDPInputs[0].BindAddress != ":5555" {
|
||||
t.Fatalf("unexpected udp bind address: %s", c.UDPInputs[0].BindAddress)
|
||||
}
|
||||
|
||||
if c.UDPInputs[1].BindAddress != ":1234" {
|
||||
t.Fatalf("unexpected udp bind address: %s", c.UDPInputs[1].BindAddress)
|
||||
}
|
||||
|
||||
if c.GraphiteInputs[1].Protocol != "udp" {
|
||||
t.Fatalf("unexpected graphite protocol: %s", c.GraphiteInputs[1].Protocol)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue