From ba71e7f234f8f62810ba2f877eb8d09820bffb40 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 2 Jul 2018 06:19:25 -0400 Subject: [PATCH] Update config for internal dataDB --- data/conf/samples/internal/cgrates.json | 144 ++++++++++++++++++++++++ engine/storage_utils.go | 8 +- engine/version.go | 6 +- utils/consts.go | 1 - 4 files changed, 150 insertions(+), 9 deletions(-) diff --git a/data/conf/samples/internal/cgrates.json b/data/conf/samples/internal/cgrates.json index 776121c1d..68159d45b 100755 --- a/data/conf/samples/internal/cgrates.json +++ b/data/conf/samples/internal/cgrates.json @@ -62,9 +62,153 @@ }, +"cache":{ + "destinations": {"limit": 10000, "ttl":"0s", "precache": true}, + "reverse_destinations": {"limit": 10000, "ttl":"0s", "precache": true}, + "rating_plans": {"limit": 10000, "ttl":"0s","precache": true}, + "rating_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "lcr_rules": {"limit": 10000, "ttl":"0s", "precache": true}, + "cdr_stats": {"limit": 10000, "ttl":"0s", "precache": true}, + "actions": {"limit": 10000, "ttl":"0s", "precache": true}, + "action_plans": {"limit": 10000, "ttl":"0s", "precache": true}, + "account_action_plans": {"limit": 10000, "ttl":"0s", "precache": true}, + "action_triggers": {"limit": 10000, "ttl":"0s", "precache": true}, + "shared_groups": {"limit": 10000, "ttl":"0s", "precache": true}, + "aliases": {"limit": 10000, "ttl":"0s", "precache": true}, + "reverse_aliases": {"limit": 10000, "ttl":"0s", "precache": true}, + "derived_chargers": {"limit": 10000, "ttl":"0s", "precache": true}, + "resource_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "resources": {"limit": 10000, "ttl":"0s", "precache": true}, + "statqueues": {"limit": 10000, "ttl":"0s", "precache": true}, + "statqueue_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "thresholds": {"limit": 10000, "ttl":"0s", "precache": true}, + "threshold_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "filters": {"limit": 10000, "ttl":"0s", "precache": true}, + "supplier_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "attribute_profiles": {"limit": 10000, "ttl":"0s", "precache": true}, + "resource_filter_indexes" :{"limit": 10000, "ttl":"0s"}, + "resource_filter_revindexes" : {"limit": 10000, "ttl":"0s"}, + "stat_filter_indexes" : {"limit": 10000, "ttl":"0s"}, + "stat_filter_revindexes" : {"limit": 10000, "ttl":"0s"}, + "threshold_filter_indexes" : {"limit": 10000, "ttl":"0s"}, + "threshold_filter_revindexes" : {"limit": 10000, "ttl":"0s"}, + "supplier_filter_indexes" : {"limit": 10000, "ttl":"0s"}, + "supplier_filter_revindexes" :{"limit": 10000, "ttl":"0s"}, + "attribute_filter_indexes" : {"limit": 10000, "ttl":"0s"}, + "attribute_filter_revindexes" : {"limit": 10000, "ttl":"0s"}, +}, + + "rals": { "enabled": true, + "thresholds_conns": [ + {"address": "*internal"} + ], + "cdrstats_conns": [ + {"address": "*internal"} + ], + "pubsubs_conns": [ + {"address": "*internal"} + ], + "users_conns": [ + {"address": "*internal"} + ], + "aliases_conns": [ + {"address": "*internal"} + ], +}, + + +"scheduler": { + "enabled": true, }, +"cdrs": { + "enabled": true, + "cdrstats_conns": [ + {"address": "*internal"} + ], +}, + + +"cdre": { + "TestTutITExportCDR": { + "content_fields": [ + {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, + {"tag": "RunID", "type": "*composed", "value": "RunID"}, + {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, + {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, + {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, + {"tag":"Category", "type": "*composed", "value": "Category"}, + {"tag":"Account", "type": "*composed", "value": "Account"}, + {"tag":"Destination", "type": "*composed", "value": "Destination"}, + {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag":"Usage", "type": "*composed", "value": "Usage"}, + {"tag":"Cost", "type": "*composed", "value": "Cost", "rounding_decimals": 4}, + {"tag":"MatchedDestinationID", "type": "*composed", "value": "~CostDetails:s/\"MatchedDestId\":.*_(\\w{4})/${1}/:s/\"MatchedDestId\":\"INTERNAL\"/ON010/"}, + ], + }, +}, + + +"cdrstats": { + "enabled": true, +}, + + +"pubsubs": { + "enabled": true, +}, + + +"users": { + "enabled": true, + "indexes": ["Uuid"], +}, + + +"resources": { + "enabled": true, + "store_interval": "1s", + "thresholds_conns": [ + {"address": "*internal"} + ], +}, + + +"stats": { + "enabled": true, + "store_interval": "1s", + "thresholds_conns": [ + {"address": "*internal"} + ], +}, + + +"thresholds": { + "enabled": true, + "store_interval": "1s", +}, + + +"suppliers": { + "enabled": true, +}, + + +"attributes": { // Attribute service + "enabled": true, // starts Alias service: . +}, + + +"aliases": { + "enabled": true, +}, + + +"sessions": { + "enabled": true, +}, + } diff --git a/engine/storage_utils.go b/engine/storage_utils.go index e0fa7d68e..0cf173887 100644 --- a/engine/storage_utils.go +++ b/engine/storage_utils.go @@ -120,11 +120,11 @@ func ConfigureCdrStorage(db_type, host, port, name, user, pass string, d, err = NewMySQLStorage(host, port, name, user, pass, maxConn, maxIdleConn, connMaxLifetime) case utils.MONGO: d, err = NewMongoStorage(host, port, name, user, pass, utils.StorDB, cdrsIndexes, nil, 1) - case utils.INTERNAL: + case utils.MetaInternal: d, err = NewMapStorage() default: err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are [%s, %s, %s, %s]", - db_type, utils.MYSQL, utils.MONGO, utils.POSTGRES, utils.INTERNAL)) + db_type, utils.MYSQL, utils.MONGO, utils.POSTGRES, utils.MetaInternal)) } if err != nil { return nil, err @@ -142,11 +142,11 @@ func ConfigureStorDB(db_type, host, port, name, user, pass string, d, err = NewMySQLStorage(host, port, name, user, pass, maxConn, maxIdleConn, connMaxLifetime) case utils.MONGO: d, err = NewMongoStorage(host, port, name, user, pass, utils.StorDB, cdrsIndexes, nil, 1) - case utils.INTERNAL: + case utils.MetaInternal: d, err = NewMapStorage() default: err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are [%s, %s, %s, %s]", - db_type, utils.MYSQL, utils.MONGO, utils.POSTGRES, utils.INTERNAL)) + db_type, utils.MYSQL, utils.MONGO, utils.POSTGRES, utils.MetaInternal)) } if err != nil { return nil, err diff --git a/engine/version.go b/engine/version.go index 48d55b08a..1b1e70f7c 100644 --- a/engine/version.go +++ b/engine/version.go @@ -100,14 +100,12 @@ func SetDBVersions(storage Storage) error { func (vers Versions) Compare(curent Versions, storType string) string { var x map[string]string switch storType { - case utils.MONGO: + case utils.MONGO, utils.MAPSTOR: x = allVers case utils.POSTGRES, utils.MYSQL: x = storDBVers case utils.REDIS: x = dataDBVers - case utils.MAPSTOR: - x = allVers } for y, val := range x { if vers[y] != curent[y] { @@ -190,7 +188,7 @@ func CurrentDBVersions(storType string) Versions { } switch storType { - case utils.MONGO, utils.MAPSTOR, utils.INTERNAL: + case utils.MONGO, utils.MAPSTOR: return allVersions case utils.POSTGRES, utils.MYSQL: return storDbVersions diff --git a/utils/consts.go b/utils/consts.go index 7c77d7a20..e53afaff8 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -107,7 +107,6 @@ const ( DataManager = "DataManager" REDIS = "redis" MAPSTOR = "mapstor" - INTERNAL = "internal" LOCALHOST = "127.0.0.1" FSCDR_FILE_CSV = "freeswitch_file_csv" FSCDR_HTTP_JSON = "freeswitch_http_json"