mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add CacheS conns to RALs
This commit is contained in:
@@ -234,6 +234,7 @@ const CGRATES_CFG_JSON = `
|
||||
"enabled": false, // enable Rating/Accounting service: <true|false>
|
||||
"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
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user