mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
ips: prepend options instead of append
to ensure default options are at the end. Otherwise, they would always match first.
This commit is contained in:
committed by
Dan Christian Bogos
parent
9812e6f605
commit
9ee93ed879
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user