mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Configuration rls -> resources, rls_conns -> resources_conns
This commit is contained in:
@@ -60,7 +60,7 @@ func (rsv1 *ResourceSV1) Call(serviceMethod string, args interface{}, reply inte
|
||||
return err
|
||||
}
|
||||
|
||||
// GetLimitsForEvent returns ResourceLimits matching a specific event
|
||||
// GetResourcesForEvent returns Resources matching a specific event
|
||||
func (rsv1 *ResourceSV1) GetResourcesForEvent(ev map[string]interface{}, reply *[]*engine.ResourceCfg) error {
|
||||
return rsv1.rls.V1ResourcesForEvent(ev, reply)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheDoneC
|
||||
if cCfg, has := cfg.CacheConfig[utils.CacheReverseAliases]; !has || !cCfg.Precache {
|
||||
rvAlsIDs = make([]string, 0)
|
||||
}
|
||||
if cCfg, has := cfg.CacheConfig[utils.CacheResourceLimits]; !has || !cCfg.Precache {
|
||||
if cCfg, has := cfg.CacheConfig[utils.CacheResources]; !has || !cCfg.Precache {
|
||||
rlIDs = make([]string, 0)
|
||||
}
|
||||
// ToDo: Add here timings
|
||||
|
||||
@@ -64,7 +64,7 @@ const CGRATES_CFG_JSON = `
|
||||
"aliases": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control aliases caching
|
||||
"reverse_aliases": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control reverse aliases index caching
|
||||
"derived_chargers": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control derived charging rule caching
|
||||
"resource_limits": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control resource limits caching
|
||||
"resources": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control resource caching
|
||||
"timings": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control timings caching
|
||||
},
|
||||
|
||||
@@ -284,7 +284,7 @@ const CGRATES_CFG_JSON = `
|
||||
"cdrs_conns": [
|
||||
{"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
|
||||
],
|
||||
"rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
"resources_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
"create_cdr": false, // create CDR out of events and sends them to CDRS component
|
||||
"extra_fields": [], // extra fields to store in auth/CDRs when creating them
|
||||
"debit_interval": "10s", // interval to perform debits on.
|
||||
@@ -311,7 +311,7 @@ const CGRATES_CFG_JSON = `
|
||||
"cdrs_conns": [
|
||||
{"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234>
|
||||
],
|
||||
"rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
"resources_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234>
|
||||
"create_cdr": false, // create CDR out of events and sends them to CDRS component
|
||||
"debit_interval": "10s", // interval to perform debits on.
|
||||
"min_call_duration": "0s", // only authorize calls with allowed duration higher than this
|
||||
@@ -404,7 +404,7 @@ const CGRATES_CFG_JSON = `
|
||||
},
|
||||
|
||||
|
||||
"rls": {
|
||||
"resources": {
|
||||
"enabled": false, // starts ResourceLimiter service: <true|false>.
|
||||
"stats_conns": [], // address where to reach the stats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
|
||||
"store_interval": "0s", // dump cache regularly to dataDB, 0 - dump at start/shutdown: <""|*never|$dur>
|
||||
|
||||
@@ -55,7 +55,7 @@ const (
|
||||
PUBSUBSERV_JSN = "pubsubs"
|
||||
ALIASESSERV_JSN = "aliases"
|
||||
USERSERV_JSN = "users"
|
||||
RESOURCELIMITER_JSON = "rls"
|
||||
RESOURCELIMITER_JSON = "resources"
|
||||
MAILER_JSN = "mailer"
|
||||
SURETAX_JSON = "suretax"
|
||||
)
|
||||
|
||||
@@ -109,7 +109,7 @@ func TestCacheJsonCfg(t *testing.T) {
|
||||
utils.CacheDerivedChargers: &CacheParamJsonCfg{Limit: utils.IntPointer(0),
|
||||
Ttl: utils.StringPointer("0s"), Static_ttl: utils.BoolPointer(false),
|
||||
Precache: utils.BoolPointer(false)},
|
||||
utils.CacheResourceLimits: &CacheParamJsonCfg{Limit: utils.IntPointer(0),
|
||||
utils.CacheResources: &CacheParamJsonCfg{Limit: utils.IntPointer(0),
|
||||
Ttl: utils.StringPointer("0s"), Static_ttl: utils.BoolPointer(false),
|
||||
Precache: utils.BoolPointer(false)},
|
||||
utils.CacheTimings: &CacheParamJsonCfg{Limit: utils.IntPointer(0),
|
||||
@@ -457,7 +457,7 @@ func TestSmFsJsonCfg(t *testing.T) {
|
||||
&HaPoolJsonCfg{
|
||||
Address: utils.StringPointer(utils.MetaInternal),
|
||||
}},
|
||||
Rls_conns: &[]*HaPoolJsonCfg{},
|
||||
Resources_conns: &[]*HaPoolJsonCfg{},
|
||||
Create_cdr: utils.BoolPointer(false),
|
||||
Extra_fields: utils.StringSlicePointer([]string{}),
|
||||
Debit_interval: utils.StringPointer("10s"),
|
||||
@@ -495,7 +495,7 @@ func TestSmKamJsonCfg(t *testing.T) {
|
||||
&HaPoolJsonCfg{
|
||||
Address: utils.StringPointer(utils.MetaInternal),
|
||||
}},
|
||||
Rls_conns: &[]*HaPoolJsonCfg{},
|
||||
Resources_conns: &[]*HaPoolJsonCfg{},
|
||||
Create_cdr: utils.BoolPointer(false),
|
||||
Debit_interval: utils.StringPointer("10s"),
|
||||
Min_call_duration: utils.StringPointer("0s"),
|
||||
|
||||
@@ -432,7 +432,7 @@ func TestCgrCfgJSONDefaultsCacheCFG(t *testing.T) {
|
||||
TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false},
|
||||
utils.CacheDerivedChargers: &CacheParamConfig{Limit: 0,
|
||||
TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false},
|
||||
utils.CacheResourceLimits: &CacheParamConfig{Limit: 0,
|
||||
utils.CacheResources: &CacheParamConfig{Limit: 0,
|
||||
TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false},
|
||||
utils.CacheTimings: &CacheParamConfig{Limit: 0,
|
||||
TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false},
|
||||
@@ -566,11 +566,11 @@ func TestCgrCfgJSONDefaultsResLimCfg(t *testing.T) {
|
||||
|
||||
func TestCgrCfgJSONDefaultStatsCfg(t *testing.T) {
|
||||
eStatsCfg := &StatSCfg{
|
||||
Enabled: false,
|
||||
Enabled: false,
|
||||
StoreInterval: 0,
|
||||
}
|
||||
if !reflect.DeepEqual(cgrCfg.statsCfg, eStatsCfg) {
|
||||
t.Errorf("received: %+v, expecting: %+v", cgrCfg.statsCfg, eStatsCfg)
|
||||
t.Errorf("received: %+v, expecting: %+v", cgrCfg.statsCfg, eStatsCfg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ type SmFsJsonCfg struct {
|
||||
Enabled *bool
|
||||
Rals_conns *[]*HaPoolJsonCfg
|
||||
Cdrs_conns *[]*HaPoolJsonCfg
|
||||
Rls_conns *[]*HaPoolJsonCfg
|
||||
Resources_conns *[]*HaPoolJsonCfg
|
||||
Create_cdr *bool
|
||||
Extra_fields *[]string
|
||||
Debit_interval *string
|
||||
@@ -264,7 +264,7 @@ type SmKamJsonCfg struct {
|
||||
Enabled *bool
|
||||
Rals_conns *[]*HaPoolJsonCfg
|
||||
Cdrs_conns *[]*HaPoolJsonCfg
|
||||
Rls_conns *[]*HaPoolJsonCfg
|
||||
Resources_conns *[]*HaPoolJsonCfg
|
||||
Create_cdr *bool
|
||||
Debit_interval *string
|
||||
Min_call_duration *string
|
||||
|
||||
@@ -217,9 +217,9 @@ func (self *SmFsConfig) loadFromJsonCfg(jsnCfg *SmFsJsonCfg) error {
|
||||
self.CDRsConns[idx].loadFromJsonCfg(jsnHaCfg)
|
||||
}
|
||||
}
|
||||
if jsnCfg.Rls_conns != nil {
|
||||
self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Rls_conns))
|
||||
for idx, jsnHaCfg := range *jsnCfg.Rls_conns {
|
||||
if jsnCfg.Resources_conns != nil {
|
||||
self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Resources_conns))
|
||||
for idx, jsnHaCfg := range *jsnCfg.Resources_conns {
|
||||
self.RLsConns[idx] = NewDfltHaPoolConfig()
|
||||
self.RLsConns[idx].loadFromJsonCfg(jsnHaCfg)
|
||||
}
|
||||
@@ -347,9 +347,9 @@ func (self *SmKamConfig) loadFromJsonCfg(jsnCfg *SmKamJsonCfg) error {
|
||||
self.CDRsConns[idx].loadFromJsonCfg(jsnHaCfg)
|
||||
}
|
||||
}
|
||||
if jsnCfg.Rls_conns != nil {
|
||||
self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Rls_conns))
|
||||
for idx, jsnHaCfg := range *jsnCfg.Rls_conns {
|
||||
if jsnCfg.Resources_conns != nil {
|
||||
self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Resources_conns))
|
||||
for idx, jsnHaCfg := range *jsnCfg.Resources_conns {
|
||||
self.RLsConns[idx] = NewDfltHaPoolConfig()
|
||||
self.RLsConns[idx].loadFromJsonCfg(jsnHaCfg)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
|
||||
|
||||
"rls": {
|
||||
"resources": {
|
||||
"enabled": true,
|
||||
"stats_conns": [
|
||||
//{"address": "*internal"}
|
||||
|
||||
@@ -54,7 +54,7 @@ var (
|
||||
CacheAliases: ALIASES_PREFIX,
|
||||
CacheReverseAliases: REVERSE_ALIASES_PREFIX,
|
||||
CacheDerivedChargers: DERIVEDCHARGERS_PREFIX,
|
||||
CacheResourceLimits: ResourceLimitsPrefix,
|
||||
CacheResources: ResourceLimitsPrefix,
|
||||
CacheTimings: TimingsPrefix,
|
||||
}
|
||||
CachePrefixToInstance map[string]string // will be built on init
|
||||
@@ -420,7 +420,7 @@ const (
|
||||
CacheAliases = "aliases"
|
||||
CacheReverseAliases = "reverse_aliases"
|
||||
CacheDerivedChargers = "derived_chargers"
|
||||
CacheResourceLimits = "resource_limits"
|
||||
CacheResources = "resources"
|
||||
CacheTimings = "timings"
|
||||
StatS = "stats"
|
||||
CostSource = "CostSource"
|
||||
|
||||
Reference in New Issue
Block a user