mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 07:38:45 +05:00
Remove json tags and rename the new option to be consistent with the others
This commit is contained in:
committed by
Dan Christian Bogos
parent
800a0ddcba
commit
f495a10c3b
@@ -29,29 +29,30 @@ import (
|
||||
|
||||
func TestDfGeneralJsonCfg(t *testing.T) {
|
||||
eCfg := &GeneralJsonCfg{
|
||||
Node_id: utils.StringPointer(""),
|
||||
Logger: utils.StringPointer(utils.MetaSysLog),
|
||||
Log_level: utils.IntPointer(utils.LOGLEVEL_INFO),
|
||||
Rounding_decimals: utils.IntPointer(5),
|
||||
Dbdata_encoding: utils.StringPointer("*msgpack"),
|
||||
Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"),
|
||||
Poster_attempts: utils.IntPointer(3),
|
||||
Failed_posts_dir: utils.StringPointer("/var/spool/cgrates/failed_posts"),
|
||||
Failed_posts_ttl: utils.StringPointer("5s"),
|
||||
Default_request_type: utils.StringPointer(utils.MetaRated),
|
||||
Default_category: utils.StringPointer("call"),
|
||||
Default_tenant: utils.StringPointer("cgrates.org"),
|
||||
Default_caching: utils.StringPointer(utils.MetaReload),
|
||||
Default_timezone: utils.StringPointer("Local"),
|
||||
Connect_attempts: utils.IntPointer(5),
|
||||
Reconnects: utils.IntPointer(-1),
|
||||
Connect_timeout: utils.StringPointer("1s"),
|
||||
Reply_timeout: utils.StringPointer("2s"),
|
||||
Locking_timeout: utils.StringPointer("0"),
|
||||
Digest_separator: utils.StringPointer(","),
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Rsr_separator: utils.StringPointer(";"),
|
||||
Max_parallel_conns: utils.IntPointer(100),
|
||||
Node_id: utils.StringPointer(""),
|
||||
Logger: utils.StringPointer(utils.MetaSysLog),
|
||||
Log_level: utils.IntPointer(utils.LOGLEVEL_INFO),
|
||||
Rounding_decimals: utils.IntPointer(5),
|
||||
Dbdata_encoding: utils.StringPointer("*msgpack"),
|
||||
Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"),
|
||||
Poster_attempts: utils.IntPointer(3),
|
||||
Failed_posts_dir: utils.StringPointer("/var/spool/cgrates/failed_posts"),
|
||||
Failed_posts_ttl: utils.StringPointer("5s"),
|
||||
Default_request_type: utils.StringPointer(utils.MetaRated),
|
||||
Default_category: utils.StringPointer("call"),
|
||||
Default_tenant: utils.StringPointer("cgrates.org"),
|
||||
Default_caching: utils.StringPointer(utils.MetaReload),
|
||||
Default_timezone: utils.StringPointer("Local"),
|
||||
Connect_attempts: utils.IntPointer(5),
|
||||
Reconnects: utils.IntPointer(-1),
|
||||
Max_reconnect_interval: utils.StringPointer(utils.EmptyString),
|
||||
Connect_timeout: utils.StringPointer("1s"),
|
||||
Reply_timeout: utils.StringPointer("2s"),
|
||||
Locking_timeout: utils.StringPointer("0"),
|
||||
Digest_separator: utils.StringPointer(","),
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Rsr_separator: utils.StringPointer(";"),
|
||||
Max_parallel_conns: utils.IntPointer(100),
|
||||
}
|
||||
dfCgrJSONCfg, err := NewCgrJsonCfgFromBytes([]byte(CGRATES_CFG_JSON))
|
||||
if err != nil {
|
||||
@@ -862,10 +863,11 @@ func TestFsAgentJsonCfg(t *testing.T) {
|
||||
Max_wait_connection: utils.StringPointer("2s"),
|
||||
Event_socket_conns: &[]*FsConnJsonCfg{
|
||||
{
|
||||
Address: utils.StringPointer("127.0.0.1:8021"),
|
||||
Password: utils.StringPointer("ClueCon"),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Alias: utils.StringPointer(""),
|
||||
Address: utils.StringPointer("127.0.0.1:8021"),
|
||||
Password: utils.StringPointer("ClueCon"),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Max_reconnect_interval: utils.StringPointer(utils.EmptyString),
|
||||
Alias: utils.StringPointer(""),
|
||||
}},
|
||||
}
|
||||
dfCgrJSONCfg, err := NewCgrJsonCfgFromBytes([]byte(CGRATES_CFG_JSON))
|
||||
@@ -886,8 +888,9 @@ func TestKamAgentJsonCfg(t *testing.T) {
|
||||
Create_cdr: utils.BoolPointer(false),
|
||||
Evapi_conns: &[]*KamConnJsonCfg{
|
||||
{
|
||||
Address: utils.StringPointer("127.0.0.1:8448"),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Address: utils.StringPointer("127.0.0.1:8448"),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Max_reconnect_interval: utils.StringPointer(utils.EmptyString),
|
||||
},
|
||||
},
|
||||
Timezone: utils.StringPointer(utils.EmptyString),
|
||||
@@ -911,11 +914,12 @@ func TestAsteriskAgentJsonCfg(t *testing.T) {
|
||||
Create_cdr: utils.BoolPointer(false),
|
||||
Asterisk_conns: &[]*AstConnJsonCfg{
|
||||
{
|
||||
Address: utils.StringPointer("127.0.0.1:8088"),
|
||||
User: utils.StringPointer("cgrates"),
|
||||
Password: utils.StringPointer("CGRateS.org"),
|
||||
Connect_attempts: utils.IntPointer(3),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Address: utils.StringPointer("127.0.0.1:8088"),
|
||||
User: utils.StringPointer("cgrates"),
|
||||
Password: utils.StringPointer("CGRateS.org"),
|
||||
Connect_attempts: utils.IntPointer(3),
|
||||
Reconnects: utils.IntPointer(5),
|
||||
Max_reconnect_interval: utils.StringPointer(utils.EmptyString),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ func (gencfg *GeneralCfg) loadFromJSONCfg(jsnGeneralCfg *GeneralJsonCfg) (err er
|
||||
if jsnGeneralCfg.Reconnects != nil {
|
||||
gencfg.Reconnects = *jsnGeneralCfg.Reconnects
|
||||
}
|
||||
if jsnGeneralCfg.MaxReconnectInterval != nil {
|
||||
if gencfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnGeneralCfg.MaxReconnectInterval); err != nil {
|
||||
if jsnGeneralCfg.Max_reconnect_interval != nil {
|
||||
if gencfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnGeneralCfg.Max_reconnect_interval); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ func (kamCfg *KamConnCfg) loadFromJSONCfg(jsnCfg *KamConnJsonCfg) (err error) {
|
||||
if jsnCfg.Reconnects != nil {
|
||||
kamCfg.Reconnects = *jsnCfg.Reconnects
|
||||
}
|
||||
if jsnCfg.MaxReconnectInterval != nil {
|
||||
if kamCfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.MaxReconnectInterval); err != nil {
|
||||
if jsnCfg.Max_reconnect_interval != nil {
|
||||
if kamCfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.Max_reconnect_interval); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,30 +24,30 @@ import (
|
||||
|
||||
// General config section
|
||||
type GeneralJsonCfg struct {
|
||||
Node_id *string
|
||||
Logger *string
|
||||
Log_level *int
|
||||
Rounding_decimals *int
|
||||
Dbdata_encoding *string
|
||||
Tpexport_dir *string
|
||||
Poster_attempts *int
|
||||
Failed_posts_dir *string
|
||||
Failed_posts_ttl *string
|
||||
Default_request_type *string
|
||||
Default_category *string
|
||||
Default_tenant *string
|
||||
Default_timezone *string
|
||||
Default_caching *string
|
||||
Connect_attempts *int
|
||||
Reconnects *int
|
||||
MaxReconnectInterval *string `json:"max_reconnect_interval"`
|
||||
Connect_timeout *string
|
||||
Reply_timeout *string
|
||||
Locking_timeout *string
|
||||
Digest_separator *string
|
||||
Digest_equal *string
|
||||
Rsr_separator *string
|
||||
Max_parallel_conns *int
|
||||
Node_id *string
|
||||
Logger *string
|
||||
Log_level *int
|
||||
Rounding_decimals *int
|
||||
Dbdata_encoding *string
|
||||
Tpexport_dir *string
|
||||
Poster_attempts *int
|
||||
Failed_posts_dir *string
|
||||
Failed_posts_ttl *string
|
||||
Default_request_type *string
|
||||
Default_category *string
|
||||
Default_tenant *string
|
||||
Default_timezone *string
|
||||
Default_caching *string
|
||||
Connect_attempts *int
|
||||
Reconnects *int
|
||||
Max_reconnect_interval *string
|
||||
Connect_timeout *string
|
||||
Reply_timeout *string
|
||||
Locking_timeout *string
|
||||
Digest_separator *string
|
||||
Digest_equal *string
|
||||
Rsr_separator *string
|
||||
Max_parallel_conns *int
|
||||
}
|
||||
|
||||
// Listen config section
|
||||
@@ -387,11 +387,11 @@ type FreeswitchAgentJsonCfg struct {
|
||||
|
||||
// Represents one connection instance towards FreeSWITCH
|
||||
type FsConnJsonCfg struct {
|
||||
Address *string
|
||||
Password *string
|
||||
Reconnects *int
|
||||
MaxReconnectInterval *string `json:"max_reconnect_interval"`
|
||||
Alias *string
|
||||
Address *string
|
||||
Password *string
|
||||
Reconnects *int
|
||||
Max_reconnect_interval *string
|
||||
Alias *string
|
||||
}
|
||||
|
||||
type RPCConnsJson struct {
|
||||
@@ -402,29 +402,29 @@ type RPCConnsJson struct {
|
||||
|
||||
// Represents one connection instance towards a rater/cdrs server
|
||||
type RemoteHostJson struct {
|
||||
Id *string
|
||||
Address *string
|
||||
Transport *string
|
||||
Synchronous *bool
|
||||
Tls *bool
|
||||
Key_path *string
|
||||
Cert_path *string
|
||||
Ca_path *string
|
||||
Conn_attempts *int
|
||||
Reconnects *int
|
||||
MaxReconnectInterval *string `json:"max_reconnect_interval"`
|
||||
Connect_timeout *string
|
||||
Reply_timeout *string
|
||||
Id *string
|
||||
Address *string
|
||||
Transport *string
|
||||
Synchronous *bool
|
||||
Tls *bool
|
||||
Key_path *string
|
||||
Cert_path *string
|
||||
Ca_path *string
|
||||
Conn_attempts *int
|
||||
Reconnects *int
|
||||
Max_reconnect_interval *string
|
||||
Connect_timeout *string
|
||||
Reply_timeout *string
|
||||
}
|
||||
|
||||
type AstConnJsonCfg struct {
|
||||
Alias *string
|
||||
Address *string
|
||||
User *string
|
||||
Password *string
|
||||
Connect_attempts *int
|
||||
Reconnects *int
|
||||
MaxReconnectInterval *string `json:"max_reconnect_interval"`
|
||||
Alias *string
|
||||
Address *string
|
||||
User *string
|
||||
Password *string
|
||||
Connect_attempts *int
|
||||
Reconnects *int
|
||||
Max_reconnect_interval *string
|
||||
}
|
||||
|
||||
type AsteriskAgentJsonCfg struct {
|
||||
@@ -458,10 +458,10 @@ type KamAgentJsonCfg struct {
|
||||
|
||||
// Represents one connection instance towards Kamailio
|
||||
type KamConnJsonCfg struct {
|
||||
Alias *string
|
||||
Address *string
|
||||
Reconnects *int
|
||||
MaxReconnectInterval *string `json:"max_reconnect_interval"`
|
||||
Alias *string
|
||||
Address *string
|
||||
Reconnects *int
|
||||
Max_reconnect_interval *string
|
||||
}
|
||||
|
||||
// Represents one connection instance towards OpenSIPS
|
||||
|
||||
@@ -167,8 +167,8 @@ func (rh *RemoteHost) loadFromJSONCfg(jsnCfg *RemoteHostJson) (err error) {
|
||||
if jsnCfg.Reconnects != nil {
|
||||
rh.Reconnects = *jsnCfg.Reconnects
|
||||
}
|
||||
if jsnCfg.MaxReconnectInterval != nil {
|
||||
if rh.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.MaxReconnectInterval); err != nil {
|
||||
if jsnCfg.Max_reconnect_interval != nil {
|
||||
if rh.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.Max_reconnect_interval); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ func (fs *FsConnCfg) loadFromJSONCfg(jsnCfg *FsConnJsonCfg) (err error) {
|
||||
if jsnCfg.Reconnects != nil {
|
||||
fs.Reconnects = *jsnCfg.Reconnects
|
||||
}
|
||||
if jsnCfg.MaxReconnectInterval != nil {
|
||||
if fs.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.MaxReconnectInterval); err != nil {
|
||||
if jsnCfg.Max_reconnect_interval != nil {
|
||||
if fs.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.Max_reconnect_interval); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -738,8 +738,8 @@ func (aConnCfg *AsteriskConnCfg) loadFromJSONCfg(jsnCfg *AstConnJsonCfg) (err er
|
||||
if jsnCfg.Reconnects != nil {
|
||||
aConnCfg.Reconnects = *jsnCfg.Reconnects
|
||||
}
|
||||
if jsnCfg.MaxReconnectInterval != nil {
|
||||
if aConnCfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.MaxReconnectInterval); err != nil {
|
||||
if jsnCfg.Max_reconnect_interval != nil {
|
||||
if aConnCfg.MaxReconnectInterval, err = utils.ParseDurationWithNanosecs(*jsnCfg.Max_reconnect_interval); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user