mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated the code with the new Flags format
This commit is contained in:
committed by
Dan Christian Bogos
parent
9692cf438c
commit
aecafbc290
14
utils/map.go
14
utils/map.go
@@ -261,6 +261,18 @@ func (fWp FlagParams) ParamsSlice(opt string) (ps []string) {
|
||||
return fWp[opt] // if it doesn't have the option it will return an empty slice
|
||||
}
|
||||
|
||||
// SliceFlags converts from FlagsParams to []string
|
||||
func (fWp FlagParams) SliceFlags() (sls []string) {
|
||||
for key, sub := range fWp {
|
||||
if len(sub) == 0 { // no option for these subsystem
|
||||
sls = append(sls, key)
|
||||
continue
|
||||
}
|
||||
sls = append(sls, ConcatenatedKey(key, strings.Join(sub, INFIELD_SEP)))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FlagsWithParams should store a list of flags for each subsystem
|
||||
type FlagsWithParams map[string]FlagParams
|
||||
|
||||
@@ -305,5 +317,5 @@ func (fWp FlagsWithParams) GetBool(key string) (b bool) {
|
||||
if v == nil || len(v) == 0 {
|
||||
return true // empty map
|
||||
}
|
||||
return !v.Has("*disabled") // check if has *disable param
|
||||
return v.Has(TrueStr) || !v.Has(FalseStr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user