diff --git a/data/conf/samples/apier/apier.json b/data/conf/samples/apier/apier.json index 8a63f40eb..d45eee2de 100644 --- a/data/conf/samples/apier/apier.json +++ b/data/conf/samples/apier/apier.json @@ -35,6 +35,9 @@ "cdrs": { "enabled": true, // start the CDR Server service: + "chargers_conns":[ + {"address": "*internal"} + ], "rals_conns": [ {"address": "*internal"} // address where to reach the Rater <""|*internal|127.0.0.1:2013> ], diff --git a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json index f3d48fc2f..90ab96003 100644 --- a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json +++ b/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json @@ -22,6 +22,12 @@ "cdrs": { "enabled": true, // start the CDR Server service: "store_cdrs": false, // store cdrs in storDb + "chargers_conns":[ + {"address": "*internal"} + ], + "rals_conns": [ + {"address": "*internal"} + ], "online_cdr_exports": ["http_localhost", "amqp_localhost", "http_test_file", "amqp_test_file","aws_test_file","sqs_test_file","kafka_localhost","s3_test_file"], }, diff --git a/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json b/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json index 51e0baa12..d43016883 100644 --- a/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json +++ b/data/conf/samples/cdrsonexpslave/cdrsreplicationslave.json @@ -20,6 +20,12 @@ "cdrs": { "enabled": true, // start the CDR Server service: + "chargers_conns":[ + {"address": "*internal"} + ], + "rals_conns": [ + {"address": "*internal"} + ], }, "chargers": { diff --git a/data/conf/samples/sessions/cgrates.json b/data/conf/samples/sessions/cgrates.json index 0faba60c7..4c26382d1 100644 --- a/data/conf/samples/sessions/cgrates.json +++ b/data/conf/samples/sessions/cgrates.json @@ -36,6 +36,9 @@ "chargers_conns":[ {"address": "*internal"} ], + "rals_conns": [ + {"address": "*internal"} + ], }, diff --git a/utils/map.go b/utils/map.go index a71b6009a..4adad4a4f 100644 --- a/utils/map.go +++ b/utils/map.go @@ -299,7 +299,7 @@ func (fWp FlagsWithParams) GetBool(key string) (b bool) { if v, b = fWp[key]; !b { return // not present means false } - if v != nil && len(v) != 0 { + if v == nil || len(v) == 0 { return false // empty slice } return v[0] == "true" // check only the first element diff --git a/utils/map_test.go b/utils/map_test.go index 65d8bf14f..32e07ea3f 100644 --- a/utils/map_test.go +++ b/utils/map_test.go @@ -213,3 +213,27 @@ func TestFlagsToSlice(t *testing.T) { t.Errorf("Expecting: %+v, received: %+v", sls, flgSls) } } + +func TestFlagsWithParamsGetBool(t *testing.T) { + flagsWithParams := &FlagsWithParams{ + "test": []string{"string1", "string2"}, + "test2": []string{"true", "string2"}, + "empty": []string{}, + } + key := "notpresent" + if rcv := flagsWithParams.GetBool(key); rcv != false { + t.Errorf("Expecting: false, received: %+v", ToJSON(rcv)) + } + key = "empty" + if rcv := flagsWithParams.GetBool(key); rcv != false { + t.Errorf("Expecting: false, received: %+v", ToJSON(rcv)) + } + key = "test" + if rcv := flagsWithParams.GetBool(key); rcv != false { + t.Errorf("Expecting: false, received: %+v", ToJSON(rcv)) + } + key = "test2" + if rcv := flagsWithParams.GetBool(key); rcv != true { + t.Errorf("Expecting: true, received: %+v", ToJSON(rcv)) + } +}