Small config fixes, tests corrected

This commit is contained in:
DanB
2015-07-14 20:02:12 +02:00
parent c15bed1938
commit 56e7974bea
5 changed files with 27 additions and 24 deletions

View File

@@ -529,8 +529,8 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) error {
if jsnGeneralCfg.Rounding_decimals != nil {
self.RoundingDecimals = *jsnGeneralCfg.Rounding_decimals
}
if jsnGeneralCfg.Http_skip_tls_veify != nil {
self.HttpSkipTlsVerify = *jsnGeneralCfg.Http_skip_tls_veify
if jsnGeneralCfg.Http_skip_tls_verify != nil {
self.HttpSkipTlsVerify = *jsnGeneralCfg.Http_skip_tls_verify
}
if jsnGeneralCfg.Tpexport_dir != nil {
self.TpExportPath = *jsnGeneralCfg.Tpexport_dir

View File

@@ -28,7 +28,7 @@ const CGRATES_CFG_JSON = `
// This is what you get when you load CGRateS with an empty configuration file.
"general": {
"http_skip_tls_veify": false, // if enabled Http Client will accept any TLS certificate
"http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
"rounding_decimals": 10, // system level precision for floats
"dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
"tpexport_dir": "/var/log/cgrates/tpe", // path towards export folder for offline Tariff Plans
@@ -90,7 +90,7 @@ const CGRATES_CFG_JSON = `
"balancer": "", // register to balancer as worker: <""|internal|x.y.z.y:1234>
"cdrstats": "", // address where to reach the cdrstats service, empty to disable stats functionality: <""|internal|x.y.z.y:1234>
"historys": "", // address where to reach the history service, empty to disable history functionality: <""|internal|x.y.z.y:1234>
"pubusubs": "", // address where to reach the pubusb service, empty to disable pubsub functionality: <""|internal|x.y.z.y:1234>
"pubsubs": "", // address where to reach the pubusb service, empty to disable pubsub functionality: <""|internal|x.y.z.y:1234>
"users": "", // address where to reach the user service, empty to disable user profile functionality: <""|internal|x.y.z.y:1234>
},

View File

@@ -38,16 +38,16 @@ func TestDfNewdfCgrJsonCfgFromReader(t *testing.T) {
func TestDfGeneralJsonCfg(t *testing.T) {
eCfg := &GeneralJsonCfg{
Http_skip_tls_veify: utils.BoolPointer(false),
Rounding_decimals: utils.IntPointer(10),
Dbdata_encoding: utils.StringPointer("msgpack"),
Tpexport_dir: utils.StringPointer("/var/log/cgrates/tpe"),
Default_reqtype: utils.StringPointer(utils.META_RATED),
Default_category: utils.StringPointer("call"),
Default_tenant: utils.StringPointer("cgrates.org"),
Default_subject: utils.StringPointer("cgrates"),
Connect_attempts: utils.IntPointer(3),
Reconnects: utils.IntPointer(-1)}
Http_skip_tls_verify: utils.BoolPointer(false),
Rounding_decimals: utils.IntPointer(10),
Dbdata_encoding: utils.StringPointer("msgpack"),
Tpexport_dir: utils.StringPointer("/var/log/cgrates/tpe"),
Default_reqtype: utils.StringPointer(utils.META_RATED),
Default_category: utils.StringPointer("call"),
Default_tenant: utils.StringPointer("cgrates.org"),
Default_subject: utils.StringPointer("cgrates"),
Connect_attempts: utils.IntPointer(3),
Reconnects: utils.IntPointer(-1)}
if gCfg, err := dfCgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
@@ -299,6 +299,7 @@ func TestDfCdrcJsonCfg(t *testing.T) {
Failed_calls_prefix: utils.StringPointer("missed_calls"),
Cdr_source_id: utils.StringPointer("freeswitch_csv"),
Cdr_filter: utils.StringPointer(""),
Partial_record_cache: utils.StringPointer("10s"),
Cdr_fields: &cdrFields,
},
}

View File

@@ -21,6 +21,7 @@ package config
import (
"reflect"
"testing"
"time"
"github.com/cgrates/cgrates/utils"
)
@@ -47,6 +48,7 @@ func TestLoadCdrcConfigMultipleFiles(t *testing.T) {
FailedCallsPrefix: "missed_calls",
CdrSourceId: "freeswitch_csv",
CdrFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP),
PartialRecordCache: time.Duration(10) * time.Second,
CdrFields: []*CfgCdrField{
&CfgCdrField{Tag: "tor", Type: "cdrfield", CdrFieldId: "tor", Value: utils.ParseRSRFieldsMustCompile("2", utils.INFIELD_SEP),
FieldFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP), Width: 0, Strip: "", Padding: "", Layout: "", Mandatory: true},

View File

@@ -20,16 +20,16 @@ package config
// General config section
type GeneralJsonCfg struct {
Http_skip_tls_veify *bool
Rounding_decimals *int
Dbdata_encoding *string
Tpexport_dir *string
Default_reqtype *string
Default_category *string
Default_tenant *string
Default_subject *string
Reconnects *int
Connect_attempts *int
Http_skip_tls_verify *bool
Rounding_decimals *int
Dbdata_encoding *string
Tpexport_dir *string
Default_reqtype *string
Default_category *string
Default_tenant *string
Default_subject *string
Reconnects *int
Connect_attempts *int
}
// Listen config section