mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Migrator: Added missing .json config options, updated migrator integration tests.
This commit is contained in:
committed by
Dan Christian Bogos
parent
07bca27b93
commit
9621cd2baf
@@ -162,60 +162,58 @@ func main() {
|
||||
}
|
||||
|
||||
// out settings
|
||||
if *outDataDBType == utils.MetaDataDB {
|
||||
*outDataDBType = mgrCfg.DataDbType
|
||||
} else {
|
||||
*outDataDBType = strings.TrimPrefix(*outDataDBType, "*")
|
||||
if *outDataDBType != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBType = strings.TrimPrefix(*outDataDBType, "*")
|
||||
}
|
||||
if *outDataDBHost == utils.MetaDataDB {
|
||||
*outDataDBHost = mgrCfg.DataDbHost
|
||||
if *outDataDBHost != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBHost = *outDataDBHost
|
||||
}
|
||||
if *outDataDBPort == utils.MetaDataDB {
|
||||
*outDataDBPort = mgrCfg.DataDbPort
|
||||
if *outDataDBPort != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBPort = *outDataDBPort
|
||||
}
|
||||
if *outDataDBName == utils.MetaDataDB {
|
||||
*outDataDBName = mgrCfg.DataDbName
|
||||
if *outDataDBName != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBName = *outDataDBName
|
||||
}
|
||||
if *outDataDBUser == utils.MetaDataDB {
|
||||
*outDataDBUser = mgrCfg.DataDbUser
|
||||
if *outDataDBUser != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBUser = *outDataDBUser
|
||||
}
|
||||
if *outDataDBPass == utils.MetaDataDB {
|
||||
*outDataDBPass = mgrCfg.DataDbPass
|
||||
if *outDataDBPass != utils.MetaDataDB {
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBPassword = *outDataDBPass
|
||||
}
|
||||
if *outStorDBType == utils.MetaStorDB {
|
||||
*outStorDBType = mgrCfg.StorDBType
|
||||
} else {
|
||||
*outStorDBType = strings.TrimPrefix(*outStorDBType, "*")
|
||||
if *outStorDBType != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBType = strings.TrimPrefix(*outStorDBType, "*")
|
||||
}
|
||||
if *outStorDBHost == utils.MetaStorDB {
|
||||
*outStorDBHost = mgrCfg.StorDBHost
|
||||
if *outStorDBHost != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBHost = *outStorDBHost
|
||||
}
|
||||
if *outStorDBPort == utils.MetaStorDB {
|
||||
*outStorDBPort = mgrCfg.StorDBPort
|
||||
if *outStorDBPort != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBPort = *outStorDBPort
|
||||
}
|
||||
if *outStorDBName == utils.MetaStorDB {
|
||||
*outStorDBName = mgrCfg.StorDBName
|
||||
if *outStorDBName != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBName = *outStorDBName
|
||||
}
|
||||
if *outStorDBUser == utils.MetaStorDB {
|
||||
*outStorDBUser = mgrCfg.StorDBUser
|
||||
if *outStorDBUser != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBUser = *outStorDBUser
|
||||
}
|
||||
if *outStorDBPass == utils.MetaStorDB {
|
||||
*outStorDBPass = mgrCfg.StorDBPass
|
||||
if *outStorDBPass != utils.MetaStorDB {
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBPassword = *outStorDBPass
|
||||
}
|
||||
if *outDBDataEncoding == "" {
|
||||
if *outDBDataEncoding != "" {
|
||||
*outDBDataEncoding = mgrCfg.DBDataEncoding
|
||||
}
|
||||
|
||||
sameDataDB = *outDataDBType == mgrCfg.DataDbType &&
|
||||
*outDataDBHost == mgrCfg.DataDbHost &&
|
||||
*outDataDBPort == mgrCfg.DataDbPort &&
|
||||
*outDataDBName == mgrCfg.DataDbName &&
|
||||
fmt.Printf("After change: %+v\n", utils.ToJSON(mgrCfg.MigratorCgrConfig))
|
||||
|
||||
sameDataDB = mgrCfg.MigratorCgrConfig.OutDataDBType == mgrCfg.DataDbType &&
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBHost == mgrCfg.DataDbHost &&
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBPort == mgrCfg.DataDbPort &&
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBName == mgrCfg.DataDbName &&
|
||||
*outDBDataEncoding == mgrCfg.DBDataEncoding
|
||||
|
||||
sameStorDB = *outStorDBType == mgrCfg.StorDBType &&
|
||||
*outStorDBHost == mgrCfg.StorDBHost &&
|
||||
*outStorDBPort == mgrCfg.StorDBPort &&
|
||||
*outStorDBName == mgrCfg.StorDBName &&
|
||||
sameStorDB = mgrCfg.MigratorCgrConfig.OutStorDBType == mgrCfg.StorDBType &&
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBHost == mgrCfg.StorDBHost &&
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBPort == mgrCfg.StorDBPort &&
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBName == mgrCfg.StorDBName &&
|
||||
*outDBDataEncoding == mgrCfg.DBDataEncoding
|
||||
|
||||
if dmIN, err = migrator.NewMigratorDataDB(mgrCfg.DataDbType,
|
||||
@@ -228,10 +226,10 @@ func main() {
|
||||
|
||||
if sameDataDB {
|
||||
dmOUT = dmIN
|
||||
} else if dmOUT, err = migrator.NewMigratorDataDB(*outDataDBType,
|
||||
*outDataDBHost, *outDataDBPort,
|
||||
*outDataDBName, *outDataDBUser,
|
||||
*outDataDBPass, *outDBDataEncoding,
|
||||
} else if dmOUT, err = migrator.NewMigratorDataDB(mgrCfg.MigratorCgrConfig.OutDataDBType,
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBHost, mgrCfg.MigratorCgrConfig.OutDataDBPort,
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBName, mgrCfg.MigratorCgrConfig.OutDataDBUser,
|
||||
mgrCfg.MigratorCgrConfig.OutDataDBPassword, *outDBDataEncoding,
|
||||
mgrCfg.CacheCfg(), 0); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -248,10 +246,10 @@ func main() {
|
||||
|
||||
if sameStorDB {
|
||||
storDBOut = storDBIn
|
||||
} else if storDBOut, err = migrator.NewMigratorStorDB(*outStorDBType,
|
||||
*outStorDBHost, *outStorDBPort,
|
||||
*outStorDBName, *outStorDBUser,
|
||||
*outStorDBPass,
|
||||
} else if storDBOut, err = migrator.NewMigratorStorDB(mgrCfg.MigratorCgrConfig.OutStorDBType,
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBHost, mgrCfg.MigratorCgrConfig.OutStorDBPort,
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBName, mgrCfg.MigratorCgrConfig.OutStorDBUser,
|
||||
mgrCfg.MigratorCgrConfig.OutStorDBPassword,
|
||||
mgrCfg.StorDBMaxOpenConns,
|
||||
mgrCfg.StorDBMaxIdleConns,
|
||||
mgrCfg.StorDBConnMaxLifetime,
|
||||
|
||||
@@ -359,6 +359,7 @@ type CGRConfig struct {
|
||||
sureTaxCfg *SureTaxCfg // Load here SureTax configuration, as pointer so we can have runtime reloads in the future
|
||||
ConfigReloads map[string]chan struct{} // Signals to specific entities that a config reload should occur
|
||||
LoaderCgrConfig *LoaderCgrCfg
|
||||
MigratorCgrConfig *MigratorCgrCfg
|
||||
// Cache defaults loaded from json and needing clones
|
||||
dfltCdreProfile *CdreConfig // Default cdreConfig profile
|
||||
dfltCdrcProfile *CdrcConfig // Default cdrcConfig profile
|
||||
@@ -835,6 +836,11 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
jsnMigratorCgrCfg, err := jsnCfg.MigratorCfgJson()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if jsnDataDbCfg != nil {
|
||||
if jsnDataDbCfg.Db_type != nil {
|
||||
self.DataDbType = *jsnDataDbCfg.Db_type
|
||||
@@ -1384,6 +1390,15 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
if jsnMigratorCgrCfg != nil {
|
||||
if self.MigratorCgrConfig == nil {
|
||||
self.MigratorCgrConfig = new(MigratorCgrCfg)
|
||||
}
|
||||
if self.MigratorCgrConfig.loadFromJsonCfg(jsnMigratorCgrCfg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1462,3 +1477,7 @@ func (cfg *CGRConfig) DispatcherSCfg() *DispatcherSCfg {
|
||||
func (cfg *CGRConfig) LoaderCgrCfg() *LoaderCgrCfg {
|
||||
return cfg.LoaderCgrConfig
|
||||
}
|
||||
|
||||
func (cfg *CGRConfig) MigratorCgrCfg() *MigratorCgrCfg {
|
||||
return cfg.MigratorCgrConfig
|
||||
}
|
||||
|
||||
@@ -624,5 +624,19 @@ const CGRATES_CFG_JSON = `
|
||||
],
|
||||
},
|
||||
|
||||
"migrator": {
|
||||
"out_datadb_type": "redis",
|
||||
"out_datadb_host": "127.0.0.1",
|
||||
"out_datadb_port": "6379",
|
||||
"out_datadb_name": "10",
|
||||
"out_datadb_user": "cgrates",
|
||||
"out_datadb_password": "",
|
||||
"out_stordb_type": "mysql",
|
||||
"out_stordb_host": "127.0.0.1",
|
||||
"out_stordb_port": "3306",
|
||||
"out_stordb_name": "cgrates",
|
||||
"out_stordb_user": "cgrates",
|
||||
"out_stordb_password": "",
|
||||
},
|
||||
|
||||
}`
|
||||
|
||||
@@ -65,6 +65,7 @@ const (
|
||||
SURETAX_JSON = "suretax"
|
||||
DispatcherSJson = "dispatcher"
|
||||
CgrLoaderCfgJson = "loader"
|
||||
CgrMigratorCfgJson = "migrator"
|
||||
)
|
||||
|
||||
// Loads the json config out of io.Reader, eg other sources than file, maybe over http
|
||||
@@ -461,3 +462,15 @@ func (self CgrJsonCfg) LoaderCfgJson() (*LoaderCfgJson, error) {
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func (self CgrJsonCfg) MigratorCfgJson() (*MigratorCfgJson, error) {
|
||||
rawCfg, hasKey := self[CgrMigratorCfgJson]
|
||||
if !hasKey {
|
||||
return nil, nil
|
||||
}
|
||||
cfg := new(MigratorCfgJson)
|
||||
if err := json.Unmarshal(*rawCfg, cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
@@ -1267,3 +1267,25 @@ func TestDfLoaderCfg(t *testing.T) {
|
||||
t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(eCfg), utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
func TestDfMigratorCfg(t *testing.T) {
|
||||
eCfg := &MigratorCfgJson{
|
||||
Out_dataDB_type: utils.StringPointer("redis"),
|
||||
Out_dataDB_host: utils.StringPointer("127.0.0.1"),
|
||||
Out_dataDB_port: utils.StringPointer("6379"),
|
||||
Out_dataDB_name: utils.StringPointer("10"),
|
||||
Out_dataDB_user: utils.StringPointer("cgrates"),
|
||||
Out_dataDB_password: utils.StringPointer(""),
|
||||
Out_storDB_type: utils.StringPointer("mysql"),
|
||||
Out_storDB_host: utils.StringPointer("127.0.0.1"),
|
||||
Out_storDB_port: utils.StringPointer("3306"),
|
||||
Out_storDB_name: utils.StringPointer("cgrates"),
|
||||
Out_storDB_user: utils.StringPointer("cgrates"),
|
||||
Out_storDB_password: utils.StringPointer(""),
|
||||
}
|
||||
if cfg, err := dfCgrJsonCfg.MigratorCfgJson(); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(eCfg, cfg) {
|
||||
t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(eCfg), utils.ToJSON(cfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1286,3 +1286,23 @@ func TestCgrLoaderCfgDefault(t *testing.T) {
|
||||
t.Errorf("received: %+v, expecting: %+v", utils.ToJSON(cgrCfg.LoaderCgrConfig), utils.ToJSON(eLdrCfg))
|
||||
}
|
||||
}
|
||||
|
||||
func TestCgrMigratorCfgDefault(t *testing.T) {
|
||||
eMgrCfg := &MigratorCgrCfg{
|
||||
OutDataDBType: "redis",
|
||||
OutDataDBHost: "127.0.0.1",
|
||||
OutDataDBPort: "6379",
|
||||
OutDataDBName: "10",
|
||||
OutDataDBUser: "cgrates",
|
||||
OutDataDBPassword: "",
|
||||
OutStorDBType: "mysql",
|
||||
OutStorDBHost: "127.0.0.1",
|
||||
OutStorDBPort: "3306",
|
||||
OutStorDBName: "cgrates",
|
||||
OutStorDBUser: "cgrates",
|
||||
OutStorDBPassword: "",
|
||||
}
|
||||
if !reflect.DeepEqual(cgrCfg.MigratorCgrConfig, eMgrCfg) {
|
||||
t.Errorf("received: %+v, expecting: %+v", utils.ToJSON(cgrCfg.MigratorCgrConfig), utils.ToJSON(eMgrCfg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,3 +498,18 @@ type LoaderCfgJson struct {
|
||||
Caches_conns *[]*HaPoolJsonCfg
|
||||
Scheduler_conns *[]*HaPoolJsonCfg
|
||||
}
|
||||
|
||||
type MigratorCfgJson struct {
|
||||
Out_dataDB_type *string
|
||||
Out_dataDB_host *string
|
||||
Out_dataDB_port *string
|
||||
Out_dataDB_name *string
|
||||
Out_dataDB_user *string
|
||||
Out_dataDB_password *string
|
||||
Out_storDB_type *string
|
||||
Out_storDB_host *string
|
||||
Out_storDB_port *string
|
||||
Out_storDB_name *string
|
||||
Out_storDB_user *string
|
||||
Out_storDB_password *string
|
||||
}
|
||||
|
||||
76
config/migratorcfg.go
Normal file
76
config/migratorcfg.go
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
type MigratorCgrCfg struct {
|
||||
OutDataDBType string
|
||||
OutDataDBHost string
|
||||
OutDataDBPort string
|
||||
OutDataDBName string
|
||||
OutDataDBUser string
|
||||
OutDataDBPassword string
|
||||
OutStorDBType string
|
||||
OutStorDBHost string
|
||||
OutStorDBPort string
|
||||
OutStorDBName string
|
||||
OutStorDBUser string
|
||||
OutStorDBPassword string
|
||||
}
|
||||
|
||||
func (mg *MigratorCgrCfg) loadFromJsonCfg(jsnCfg *MigratorCfgJson) (err error) {
|
||||
|
||||
if jsnCfg.Out_dataDB_type != nil {
|
||||
mg.OutDataDBType = *jsnCfg.Out_dataDB_type
|
||||
}
|
||||
if jsnCfg.Out_dataDB_host != nil {
|
||||
mg.OutDataDBHost = *jsnCfg.Out_dataDB_host
|
||||
}
|
||||
if jsnCfg.Out_dataDB_port != nil {
|
||||
mg.OutDataDBPort = *jsnCfg.Out_dataDB_port
|
||||
}
|
||||
if jsnCfg.Out_dataDB_name != nil {
|
||||
mg.OutDataDBName = *jsnCfg.Out_dataDB_name
|
||||
}
|
||||
if jsnCfg.Out_dataDB_user != nil {
|
||||
mg.OutDataDBUser = *jsnCfg.Out_dataDB_user
|
||||
}
|
||||
if jsnCfg.Out_dataDB_password != nil {
|
||||
mg.OutDataDBPassword = *jsnCfg.Out_dataDB_password
|
||||
}
|
||||
|
||||
if jsnCfg.Out_storDB_type != nil {
|
||||
mg.OutStorDBType = *jsnCfg.Out_storDB_type
|
||||
}
|
||||
if jsnCfg.Out_storDB_host != nil {
|
||||
mg.OutStorDBHost = *jsnCfg.Out_storDB_host
|
||||
}
|
||||
if jsnCfg.Out_storDB_port != nil {
|
||||
mg.OutStorDBPort = *jsnCfg.Out_storDB_port
|
||||
}
|
||||
if jsnCfg.Out_storDB_name != nil {
|
||||
mg.OutStorDBName = *jsnCfg.Out_storDB_name
|
||||
}
|
||||
if jsnCfg.Out_storDB_user != nil {
|
||||
mg.OutStorDBUser = *jsnCfg.Out_storDB_user
|
||||
}
|
||||
if jsnCfg.Out_storDB_password != nil {
|
||||
mg.OutStorDBPassword = *jsnCfg.Out_storDB_password
|
||||
}
|
||||
return nil
|
||||
}
|
||||
36
data/conf/samples/cgrmigratorconfig/cgr-migrator.cfg
Normal file
36
data/conf/samples/cgrmigratorconfig/cgr-migrator.cfg
Normal file
@@ -0,0 +1,36 @@
|
||||
# cgr-migrator configuration file
|
||||
|
||||
[general]
|
||||
datadb_encoding = json
|
||||
|
||||
[data_db]
|
||||
db_type = redis
|
||||
db_host = 127.0.0.1
|
||||
db_port = 6379
|
||||
db_name = 10
|
||||
db_user = cgrates
|
||||
db_password =
|
||||
|
||||
[stor_db]
|
||||
db_type = mysql
|
||||
db_host = 127.0.0.1
|
||||
db_port = 3306
|
||||
db_name = cgrates
|
||||
db_user = cgrates
|
||||
db_password = CGRateS.or
|
||||
|
||||
[out_data_db]
|
||||
db_type = redis
|
||||
db_host = 127.0.0.1
|
||||
db_port = 6379
|
||||
db_name = 10
|
||||
db_user = cgrates
|
||||
db_password =
|
||||
|
||||
[out_stor_db]
|
||||
db_type = mysql
|
||||
db_host = 127.0.0.1
|
||||
db_port = 3306
|
||||
db_name = cgrates
|
||||
db_user = cgrates
|
||||
db_password = CGRateS.or
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
"data_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "10",
|
||||
"db_name": "11",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
"reply_timeout": "30s",
|
||||
"dbdata_encoding": "msgpack",
|
||||
},
|
||||
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012",
|
||||
"rpc_gob": ":2013",
|
||||
"http": ":2080",
|
||||
},
|
||||
|
||||
|
||||
"data_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "11",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "mongo",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
"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"},
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_type": "redis", // data_db type: <redis|mongo>
|
||||
"db_port": 6379, // data_db port to reach the database
|
||||
"db_name": "10", // data_db database name to connect to
|
||||
"db_name": "11", // data_db database name to connect to
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
"dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
|
||||
},
|
||||
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":2012",
|
||||
"rpc_gob": ":2013",
|
||||
"http": ":2080",
|
||||
},
|
||||
|
||||
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
|
||||
"db_type": "redis", // data_db type: <redis|mongo>
|
||||
"db_port": 6379, // data_db port to reach the database
|
||||
"db_name": "11", // data_db database name to connect to
|
||||
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
"db_password": "CGRateS.org",
|
||||
},
|
||||
|
||||
|
||||
"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"},
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
@@ -104,12 +104,12 @@ func TestAccountITMove(t *testing.T) {
|
||||
|
||||
func TestAccountITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
accPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
accPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
accCfgIn, err = config.NewCGRConfigFromFolder(accPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
accPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
accPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
accCfgOut, err = config.NewCGRConfigFromFolder(accPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -122,12 +122,12 @@ func TestAccountITMoveEncoding(t *testing.T) {
|
||||
|
||||
func TestAccountITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
accPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
accPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
accCfgIn, err = config.NewCGRConfigFromFolder(accPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
accPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
accPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
accCfgOut, err = config.NewCGRConfigFromFolder(accPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -240,7 +240,8 @@ func testAccITMigrateAndMove(t *testing.T) {
|
||||
utils.VOICE: engine.Balances{v2b},
|
||||
utils.MONETARY: engine.Balances{m2}},
|
||||
UnitCounters: engine.UnitCounters{},
|
||||
ActionTriggers: engine.ActionTriggers{}}
|
||||
ActionTriggers: engine.ActionTriggers{},
|
||||
}
|
||||
switch accAction {
|
||||
case utils.Migrate:
|
||||
err := accMigrator.dmIN.setV1Account(v1Acc)
|
||||
|
||||
@@ -100,12 +100,12 @@ func TestActionITMove(t *testing.T) {
|
||||
|
||||
func TestActionITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
actPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
actCfgIn, err = config.NewCGRConfigFromFolder(actPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
actPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actCfgOut, err = config.NewCGRConfigFromFolder(actPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -119,12 +119,12 @@ func TestActionITMoveEncoding(t *testing.T) {
|
||||
/*
|
||||
func TestActionITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
actPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
actCfgIn, err = config.NewCGRConfigFromFolder(actPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
actPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actCfgOut, err = config.NewCGRConfigFromFolder(actPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -100,12 +100,12 @@ func TestActionPlanITMove(t *testing.T) {
|
||||
|
||||
func TestActionPlanITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
actPlnPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actPlnPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
actPlnCfgIn, err = config.NewCGRConfigFromFolder(actPlnPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actPlnPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
actPlnPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actPlnCfgOut, err = config.NewCGRConfigFromFolder(actPlnPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -118,12 +118,12 @@ func TestActionPlanITMoveEncoding(t *testing.T) {
|
||||
|
||||
func TestActionPlanITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
actPlnPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actPlnPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
actPlnCfgIn, err = config.NewCGRConfigFromFolder(actPlnPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actPlnPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
actPlnPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actPlnCfgOut, err = config.NewCGRConfigFromFolder(actPlnPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -103,12 +103,12 @@ func TestActionTriggerITMove(t *testing.T) {
|
||||
|
||||
func TestActionTriggerITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
actTrgPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actTrgPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
actTrgCfgIn, err = config.NewCGRConfigFromFolder(actTrgPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actTrgPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
actTrgPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
actTrgCfgOut, err = config.NewCGRConfigFromFolder(actTrgPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -121,12 +121,12 @@ func TestActionTriggerITMoveEncoding(t *testing.T) {
|
||||
|
||||
func TestActionTriggerITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
actTrgPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actTrgPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
actTrgCfgIn, err = config.NewCGRConfigFromFolder(actTrgPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actTrgPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
actTrgPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
actTrgCfgOut, err = config.NewCGRConfigFromFolder(actTrgPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -100,12 +100,12 @@ func TestSharedGroupITMove(t *testing.T) {
|
||||
|
||||
func TestSharedGroupITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
shrGrpPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
shrGrpPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
shrGrpCfgIn, err = config.NewCGRConfigFromFolder(shrGrpPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
shrGrpPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
shrGrpPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
shrGrpCfgOut, err = config.NewCGRConfigFromFolder(shrGrpPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -118,12 +118,12 @@ func TestSharedGroupITMoveEncoding(t *testing.T) {
|
||||
|
||||
func TestSharedGroupITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
shrGrpPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
shrGrpPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
shrGrpCfgIn, err = config.NewCGRConfigFromFolder(shrGrpPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
shrGrpPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
shrGrpPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
shrGrpCfgOut, err = config.NewCGRConfigFromFolder(shrGrpPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -101,12 +101,12 @@ func TestThresholdsITMove(t *testing.T) {
|
||||
|
||||
func TestThresholdsITMoveEncoding(t *testing.T) {
|
||||
var err error
|
||||
trsPathIn = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
trsPathIn = path.Join(*dataDir, "conf", "samples", "tutmongo")
|
||||
trsCfgIn, err = config.NewCGRConfigFromFolder(trsPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
trsPathOut = path.Join(*dataDir, "conf", "samples", "tutmongomsgpack")
|
||||
trsPathOut = path.Join(*dataDir, "conf", "samples", "tutmongojson")
|
||||
trsCfgOut, err = config.NewCGRConfigFromFolder(trsPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -119,12 +119,12 @@ func TestThresholdsITMoveEncoding(t *testing.T) {
|
||||
|
||||
func TestThresholdsITMoveEncoding2(t *testing.T) {
|
||||
var err error
|
||||
trsPathIn = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
trsPathIn = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
trsCfgIn, err = config.NewCGRConfigFromFolder(trsPathIn)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
trsPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqlmsgpack")
|
||||
trsPathOut = path.Join(*dataDir, "conf", "samples", "tutmysqljson")
|
||||
trsCfgOut, err = config.NewCGRConfigFromFolder(trsPathOut)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user