mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 05:39:54 +05:00
Changed sql opts for Event Reader and Event Exporter
This commit is contained in:
committed by
Dan Christian Bogos
parent
893da9be8d
commit
d20f8dac7b
@@ -380,7 +380,7 @@ const CGRATES_CFG_JSON = `
|
||||
// "exchange": "",
|
||||
// "exchangeType": "",
|
||||
// "routingKey": "",
|
||||
|
||||
|
||||
// "exchangeProcessed": "",
|
||||
// "exchangeTypeProcessed": "",
|
||||
// "routingKeyProcessed": "",
|
||||
@@ -395,11 +395,11 @@ const CGRATES_CFG_JSON = `
|
||||
|
||||
// SQL
|
||||
// "dbName": "cgrates", // the name of the database from were the events are read
|
||||
// "tableName": "cdrs", // the name of the table from were the events are read
|
||||
// "sqlTableName": "cdrs", // the name of the table from were the events are read
|
||||
// "sslmode": "disable", // the postgresSSLMode for postgres db
|
||||
|
||||
// "dbNameProcessed": "", // the name of the database were the events are sent after they are processed
|
||||
// "tableNameProcessed": "", // the name of the table were the events are sent after they are processed
|
||||
// "sqlTableNameProcessed": "", // the name of the table were the events are sent after they are processed
|
||||
// "sslmodeProcessed": "", // the postgresSSLMode for postgres db
|
||||
|
||||
// SQS and S3
|
||||
@@ -451,7 +451,7 @@ const CGRATES_CFG_JSON = `
|
||||
"type": "*none", // exporter type
|
||||
"export_path": "/var/spool/cgrates/ees", // path where the exported events will be placed
|
||||
"opts": {
|
||||
|
||||
|
||||
// General
|
||||
// "queueID": "cgrates_cdrs", // the queue id where events are exported
|
||||
|
||||
@@ -479,7 +479,7 @@ const CGRATES_CFG_JSON = `
|
||||
// "sqlMaxConnLifetime": 0, // SQLMaxConnLifetime
|
||||
|
||||
|
||||
// "tableName":"cdrs", // the name of the table from where the events are exported
|
||||
// "sqlTableName":"cdrs", // the name of the table from where the events are exported
|
||||
// "dbName": "cgrates", // the name of the database from where the events are exported
|
||||
// "sslmode": "disable", // the postgresSSLMode for postgres
|
||||
|
||||
|
||||
@@ -374,11 +374,11 @@
|
||||
|
||||
// // SQL
|
||||
// // "dbName": "cgrates", // the name of the database from were the events are read
|
||||
// // "tableName": "cdrs", // the name of the table from were the events are read
|
||||
// // "sqlTableName": "cdrs", // the name of the table from were the events are read
|
||||
// // "sslmode": "disable", // the ssl mode for postgres db
|
||||
|
||||
// // "dbNameProcessed": "", // the name of the database were the events are sent after they are processed
|
||||
// // "tableNameProcessed": "", // the name of the table were the events are sent after they are processed
|
||||
// // "sqlTableNameProcessed": "", // the name of the table were the events are sent after they are processed
|
||||
// // "sslmodeProcessed": "", // the ssl mode for postgres db
|
||||
|
||||
// // SQS and S3
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
"attempts": 1,
|
||||
"opts": {
|
||||
"dbName": "exportedDatabase", // if dbName is not present "cgrates" will be used as default
|
||||
"tableName": "expTable", // tableName is mandatory in opts for sql exporter
|
||||
"sqlTableName": "expTable", // tableName is mandatory in opts for sql exporter
|
||||
"sslmode": "disable",
|
||||
"sqlMaxIdleConns": "10",
|
||||
"sqlMaxOpenConns": "100",
|
||||
@@ -416,7 +416,7 @@
|
||||
"attempts": 1,
|
||||
"opts": {
|
||||
"dbName": "exportedDatabase",
|
||||
"tableName": "expTable",
|
||||
"sqlTableName": "expTable",
|
||||
"sslmode": "disable",
|
||||
"sqlMaxIdleConns": "10",
|
||||
"sqlMaxOpenConns": "100",
|
||||
|
||||
@@ -235,7 +235,7 @@ func TestNewEventExporterCase8(t *testing.T) {
|
||||
cgrCfg.EEsCfg().Exporters[0].Type = utils.MetaSQL
|
||||
filterS := engine.NewFilterS(cgrCfg, nil, nil)
|
||||
_, err := NewEventExporter(cgrCfg, 0, filterS)
|
||||
errExpect := "MANDATORY_IE_MISSING: [tableName]"
|
||||
errExpect := "MANDATORY_IE_MISSING: [sqlTableName]"
|
||||
if err == nil || err.Error() != errExpect {
|
||||
t.Errorf("Expected %+v \n but got %+v", errExpect, err)
|
||||
}
|
||||
|
||||
@@ -328,6 +328,7 @@ func (rdr *SQLEventReader) setURL(inURL, outURL string, opts map[string]interfac
|
||||
rdr.expTableName = utils.CDRsTBL
|
||||
if vals, has := processedOpt[utils.SQLTableName]; has {
|
||||
rdr.expTableName = utils.IfaceAsString(vals)
|
||||
|
||||
}
|
||||
|
||||
switch rdr.expConnType {
|
||||
|
||||
@@ -100,7 +100,7 @@ func testSQLInitConfig(t *testing.T) {
|
||||
"opts": {
|
||||
"dbName":"cgrates2",
|
||||
"dbNameProcessed":"cgrates2",
|
||||
"tableNameProcessed":"cdrs2",
|
||||
"sqlTableNameProcessed":"cdrs2",
|
||||
},
|
||||
"processed_path": "", // move processed data here
|
||||
"tenant": "cgrates.org", // tenant used by import
|
||||
@@ -377,7 +377,7 @@ func testSQLInitConfig2(t *testing.T) {
|
||||
"opts": {
|
||||
"dbName":"cgrates2",
|
||||
"dbNameProcessed":"cgrates2",
|
||||
"tableNameProcessed":"cdrs2",
|
||||
"sqlTableNameProcessed":"cdrs2",
|
||||
},
|
||||
"processed_path": "", // move processed data here
|
||||
"tenant": "cgrates.org", // tenant used by import
|
||||
|
||||
@@ -41,13 +41,13 @@ func TestSQLSetURL(t *testing.T) {
|
||||
inURL := "*mysql://cgrates:CGRateS.org@127.0.0.1:3306"
|
||||
outURL := "*mysql://cgrates:CGRateS.org@127.0.0.1:3306"
|
||||
if err := sql.setURL(inURL, outURL, map[string]interface{}{
|
||||
"dbName": "cgrates2",
|
||||
"tableName": "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
"dbName": "cgrates2",
|
||||
utils.SQLTableName: "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
|
||||
"dbNameProcessed": "cgrates3",
|
||||
"tableNameProcessed": "cdrs3",
|
||||
"sslmodeProcessed": "enabled",
|
||||
"dbNameProcessed": "cgrates3",
|
||||
"sqlTableNameProcessed": "cdrs3",
|
||||
"sslmodeProcessed": "enabled",
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if expsql.connString != sql.connString {
|
||||
@@ -76,13 +76,13 @@ func TestSQLSetURL(t *testing.T) {
|
||||
inURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306"
|
||||
outURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306"
|
||||
if err := sql.setURL(inURL, outURL, map[string]interface{}{
|
||||
"dbName": "cgrates2",
|
||||
"tableName": "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
"dbName": "cgrates2",
|
||||
"sqlTableName": "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
|
||||
"dbNameProcessed": "cgrates3",
|
||||
"tableNameProcessed": "cdrs3",
|
||||
"sslmodeProcessed": "enabled",
|
||||
"dbNameProcessed": "cgrates3",
|
||||
"sqlTableNameProcessed": "cdrs3",
|
||||
"sslmodeProcessed": "enabled",
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if expsql.connString != sql.connString {
|
||||
@@ -111,13 +111,13 @@ func TestSQLSetURL(t *testing.T) {
|
||||
inURL = "*postgres://cgrates:CGRateS.org@127.0.0.1:3306"
|
||||
outURL = ""
|
||||
if err := sql.setURL(inURL, outURL, map[string]interface{}{
|
||||
"dbName": "cgrates2",
|
||||
"tableName": "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
"dbName": "cgrates2",
|
||||
"sqlTableName": "cdrs2",
|
||||
"sslmode": "enabled",
|
||||
|
||||
"dbNameProcessed": "cgrates2",
|
||||
"tableNameProcessed": "cdrs2",
|
||||
"sslmodeProcessed": "enabled",
|
||||
"dbNameProcessed": "cgrates2",
|
||||
"sqlTableNameProcessed": "cdrs2",
|
||||
"sslmodeProcessed": "enabled",
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if expsql.connString != sql.connString {
|
||||
|
||||
@@ -2559,7 +2559,7 @@ const (
|
||||
KafkaDefaultMaxWait = time.Millisecond
|
||||
|
||||
SQLDBName = "dbName"
|
||||
SQLTableName = "tableName"
|
||||
SQLTableName = "sqlTableName"
|
||||
SQLDefaultSSLMode = "disable"
|
||||
SQLDefaultDBName = "cgrates"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user