18 Commits

Author SHA1 Message Date
Vincent Bernat
abca5e983d chore: modernize some code 2025-11-14 23:22:02 +01:00
Vincent Bernat
18beb310ee chore: replace interface{} with any 2025-07-29 07:42:49 +02:00
Vincent Bernat
76151bea66 common/helpers: make some mapstructure hooks work with embedded structs
When using `mapstructure:",squash"`, most structure-specific hook don't
dive into the structure as they are provided with the parent structure.
Add an helper to make them work on the embedded structure as well and
use it for the generic "deprecated fields" hook, but also for the hook
for the common Kafka configuration.

This is a bit brittle. There are other use cases, but they may not need
this change.
2025-07-27 21:44:28 +02:00
Vincent Bernat
5a9a6e6f0a common/helpers: add a hook to deprecate some fields
And apply it to SystemLogTTL and PrometheusEndpoint. It would be nice to
log a warning, but we don't have access to a logger here.
2025-07-27 21:44:28 +02:00
Vincent Bernat
e1672c7f32 common/helpers: fix decoding of strings as slice
We use the previous version of the function from upstream.
2025-02-15 14:51:17 +01:00
Vincent Bernat
e08331a286 common/helpers: switch to a blessed fork of mapstructure 2025-02-15 14:51:17 +01:00
Vincent Bernat
c948b9779e common/helper: add a helper to rename a configuration setting 2024-08-21 19:19:38 +02:00
Vincent Bernat
a449736a62 build: use Go 1.22 range over ints
Done with:

```
git grep -l 'for.*:= 0.*++' \
  | xargs sed -i -E 's/for (.*) := 0; \1 < (.*); \1\+\+/for \1 := range \2/'
```

And a few manual fixes due to unused variables. There is something fishy
in BMP rib test. Add a comment about that. This is not equivalent (as
with range, random is evaluated once, while in the original loop, it is
evaluated at each iteration). I believe the intent was to behave like
with range.
2024-08-14 10:11:35 +02:00
Vincent Bernat
0239cd0a9f common: remove MarshalJSON helpers for mapstructure
They are not needed anymore since we don't exchange configuration files
using JSON, since baac495b9c.
2024-07-20 14:51:40 +02:00
Vincent Bernat
4069ecd158 common/helpers: add an helper to set default values for inner structs 2023-04-23 13:16:44 +02:00
Vincent Bernat
1ec89aac1f build: fix various lint issues
revive default configuration has changed in 1.3.0. Some stuff is a bit
silly (like empty blocks), but I find it easier to follow that than to
try to tweak the configuration.
2023-03-21 00:01:13 +01:00
Vincent Bernat
4db5ac7544 http: fix cache configuration marshal/unmarshal
Also, enable Redis by default, as stated in changelog.
2022-12-22 18:32:52 +01:00
Vincent Bernat
f1f83a2ba8 common/helpers: move parametrized configuration to helpers package 2022-12-21 16:34:22 +01:00
Vincent Bernat
c3d2fc64f8 helpers/mapstructure: turn panic while decoding to an error message
While there is more helpful information in a panic, this is confusing
to the user. With the amount of code using reflection, it seems better
to have clearer messages to help the user find the faulty section if
any.
2022-08-30 20:32:45 +02:00
Vincent Bernat
086536ad03 common/helpers: rename AddMapstructureUnmarshallerHook to Register* 2022-08-14 15:08:00 +02:00
Vincent Bernat
5cdc567828 inlet/core: also accept a map from subnet for default-sampling-rate
This should be generalized to other parts of configuration (SNMP
community), however, we need to check what happens with default
values. Also, network definition in orchestrator is likely to be able
to reuse that.
2022-07-31 20:36:46 +02:00
Vincent Bernat
8ee2750012 inlet/geoip: rename country-database to geo-database
This is a first step to accept another kind of GeoIP database (like
City). This also introduces the way we want to deprecate stuff:
transform the map structure.
2022-07-29 15:55:39 +02:00
Vincent Bernat
085d4e7946 cmd: add a registration mechanism for mapstructure hooks 2022-07-21 17:46:01 +02:00