From 9ee93ed879a216652445c63e7ca1221f9616eae4 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 30 May 2025 18:00:44 +0300 Subject: [PATCH] ips: prepend options instead of append to ensure default options are at the end. Otherwise, they would always match first. --- config/ips.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/ips.go b/config/ips.go index c6ba42ebb..dca05d4e0 100644 --- a/config/ips.go +++ b/config/ips.go @@ -184,26 +184,29 @@ func (o *IPsOpts) loadFromJSONCfg(jc *IPsOptsJson) error { if jc == nil { return nil } + + // NOTE: prepend to the existing slice to ensure that the default opts that + // always match are at the end. if jc.UsageID != nil { usageID, err := InterfaceToDynamicStringOpts(jc.UsageID) if err != nil { return err } - o.UsageID = append(o.UsageID, usageID...) + o.UsageID = append(usageID, o.UsageID...) } if jc.TTL != nil { ttl, err := IfaceToDurationDynamicOpts(jc.TTL) if err != nil { return err } - o.TTL = append(o.TTL, ttl...) + o.TTL = append(ttl, o.TTL...) } if jc.Units != nil { units, err := InterfaceToFloat64DynamicOpts(jc.Units) if err != nil { return err } - o.Units = append(o.Units, units...) + o.Units = append(units, o.Units...) } return nil }