diff --git a/config/config_defaults.go b/config/config_defaults.go index 202ba43e5..b797e24ed 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -474,7 +474,7 @@ const CGRATES_CFG_JSON = ` // SQL - // "maxIdleConns": 0, // SQLMaxIdleConns + // "sqlMaxIdleConns": 0, // SQLMaxIdleConns // "maxOpenConns": 0, // SQLMaxOpenConns // "maxConnLifetime": 0, // SQLMaxConnLifetime diff --git a/data/conf/samples/ees/cgrates.json b/data/conf/samples/ees/cgrates.json index 3536211d9..e9cf021c7 100644 --- a/data/conf/samples/ees/cgrates.json +++ b/data/conf/samples/ees/cgrates.json @@ -397,7 +397,7 @@ "dbName": "exportedDatabase", // if dbName is not present "cgrates" will be used as default "tableName": "expTable", // tableName is mandatory in opts for sql exporter "sslmode": "disable", - "maxIdleConns": "10", + "sqlMaxIdleConns": "10", "maxOpenConns": "100", "maxConnLifetime": "0", }, @@ -418,7 +418,7 @@ "dbName": "exportedDatabase", "tableName": "expTable", "sslmode": "disable", - "maxIdleConns": "10", + "sqlMaxIdleConns": "10", "maxOpenConns": "100", "maxConnLifetime": "0", }, diff --git a/ees/sql.go b/ees/sql.go index 2211a1620..65eb2f6f0 100644 --- a/ees/sql.go +++ b/ees/sql.go @@ -107,7 +107,7 @@ func openDB(cgrCfg *config.CGRConfig, cfgIdx int, dialect gorm.Dialector) (db *g return } - if iface, has := cgrCfg.EEsCfg().Exporters[cfgIdx].Opts[utils.SQLMaxIdleConns]; has { + if iface, has := cgrCfg.EEsCfg().Exporters[cfgIdx].Opts[utils.SQLMaxIdleConnsCfg]; has { val, err := utils.IfaceAsTInt64(iface) if err != nil { return nil, nil, err diff --git a/ees/sql_it_test.go b/ees/sql_it_test.go index 247af3032..2cd0290ed 100644 --- a/ees/sql_it_test.go +++ b/ees/sql_it_test.go @@ -231,7 +231,7 @@ func testSqlEeVerifyExportedEvent2(t *testing.T) { func TestOpenDB1(t *testing.T) { cgrCfg := config.NewDefaultCGRConfig() - cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConns] = 2 + cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConnsCfg] = 2 dialect := mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true&sql_mode='ALLOW_INVALID_DATES'", "cgrates", "CGRateS.org", "127.0.0.1", "3306", "cgrates")) _, _, err := openDB(cgrCfg, 0, dialect) @@ -242,7 +242,7 @@ func TestOpenDB1(t *testing.T) { func TestOpenDB1Err(t *testing.T) { cgrCfg := config.NewDefaultCGRConfig() - cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConns] = "test" + cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConnsCfg] = "test" dialect := mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true&sql_mode='ALLOW_INVALID_DATES'", "cgrates", "CGRateS.org", "127.0.0.1", "3306", "cgrates")) _, _, err := openDB(cgrCfg, 0, dialect) diff --git a/utils/consts.go b/utils/consts.go index 6873bad97..619fba549 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -2466,7 +2466,6 @@ const ( ElsVersionType = "elsVersionType" ElsWaitForActiveShards = "elsWaitForActiveShards" // SQLEe options - SQLMaxIdleConns = "maxIdleConns" SQLMaxOpenConns = "maxOpenConns" SQLMaxConnLifetime = "maxConnLifetime"