diff --git a/config/config_defaults.go b/config/config_defaults.go index 997c4374b..f98b0f8f9 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -234,6 +234,7 @@ const CGRATES_CFG_JSON = ` "enabled": false, // enable Rating/Accounting service: "thresholds_conns": [], // connections to ThresholdS for account/balance updates, empty to disable thresholds functionality: <""|*internal|x.y.z.y:1234> "stats_conns": [], // connections to StatS for account/balance updates, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> + "caches_conns":["*internal"], // connections to CacheS for account/balance updates "rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject "remove_expired":true, // enables automatic removal of expired balances "max_computed_usage": { // do not compute usage higher than this, prevents memory overload diff --git a/config/config_json_test.go b/config/config_json_test.go index d980ba441..24ae62f71 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -390,6 +390,7 @@ func TestDfRalsJsonCfg(t *testing.T) { Enabled: utils.BoolPointer(false), Thresholds_conns: &[]string{}, Stats_conns: &[]string{}, + CacheS_conns: &[]string{utils.MetaInternal}, Rp_subject_prefix_matching: utils.BoolPointer(false), Remove_expired: utils.BoolPointer(true), Max_computed_usage: &map[string]string{ diff --git a/config/libconfig_json.go b/config/libconfig_json.go index eb0a5d070..01bc72c73 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -114,6 +114,7 @@ type RalsJsonCfg struct { Enabled *bool Thresholds_conns *[]string Stats_conns *[]string + CacheS_conns *[]string Rp_subject_prefix_matching *bool Remove_expired *bool Max_computed_usage *map[string]string diff --git a/config/ralscfg.go b/config/ralscfg.go index cfca36bbb..1f97c58e7 100644 --- a/config/ralscfg.go +++ b/config/ralscfg.go @@ -29,6 +29,7 @@ type RalsCfg struct { Enabled bool // start standalone server (no balancer) ThresholdSConns []string // address where to reach ThresholdS config StatSConns []string + CacheSConns []string RpSubjectPrefixMatching bool // enables prefix matching for the rating profile subject RemoveExpired bool MaxComputedUsage map[string]time.Duration @@ -66,6 +67,17 @@ func (ralsCfg *RalsCfg) loadFromJsonCfg(jsnRALsCfg *RalsJsonCfg) (err error) { } } } + if jsnRALsCfg.CacheS_conns != nil { + ralsCfg.CacheSConns = make([]string, len(*jsnRALsCfg.CacheS_conns)) + for idx, conn := range *jsnRALsCfg.CacheS_conns { + // if we have the connection internal we change the name so we can have internal rpc for each subsystem + if conn == utils.MetaInternal { + ralsCfg.CacheSConns[idx] = utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches) + } else { + ralsCfg.CacheSConns[idx] = conn + } + } + } if jsnRALsCfg.Rp_subject_prefix_matching != nil { ralsCfg.RpSubjectPrefixMatching = *jsnRALsCfg.Rp_subject_prefix_matching }