Default configuration skel for ers

This commit is contained in:
DanB
2019-08-27 18:32:10 +02:00
parent 1f083508a3
commit d48dc38497
4 changed files with 65 additions and 2 deletions

View File

@@ -304,7 +304,7 @@ const CGRATES_CFG_JSON = `
"id": "*default", // identifier of the EventReader profile
"type": "*file_csv", // reader type <*file_csv>
"field_separator": ",", // separator used in case of csv files
"run_delay": 0, // sleep interval in seconds between consecutive runs, 0 to use automation via inotify
"run_delay": 0, // sleep interval in seconds between consecutive runs, -1 to use automation via inotify or 0 to disable running all together
"concurrent_requests": 1024, // maximum simultaneous requests/files to process, 0 for unlimited
"source_path": "/var/spool/cgrates/cdrc/in", // read data from this path
"processed_path": "/var/spool/cgrates/cdrc/out", // move processed data here

View File

@@ -0,0 +1,55 @@
{
// CGRateS Configuration file
//
// Used for SessionSv1 integration tests
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012",
"rpc_gob": ":2013",
"http": ":2080",
},
"stor_db": {
"db_password": "CGRateS.org",
},
"rals": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"chargers_conns": [],
"rals_conns": [],
},
"sessions": {
"enabled": true,
"cdrs_conns": [
{"address": "*internal"}
],
},
"ers": {
"enabled": true,
"readers": [
{
"id": "file_reader1",
"run_delay": -1,
},
],
},
}

View File

@@ -71,8 +71,8 @@ func (erS *ERService) ListenAndServe(cfgRldChan chan struct{},
}
}
erS.rdrs[rdrCfg.SourcePath] = append(erS.rdrs[rdrCfg.SourcePath], rdr)
}
//fmt.Printf("ERSService: %s\n", utils.ToIJSON(erS.rdrs))
go erS.handleReloads(cfgRldChan, exitChan)
e := <-exitChan
exitChan <- e // put back for the others listening for shutdown request

View File

@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package ers
import (
"fmt"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
)
@@ -34,5 +36,11 @@ type EventReader interface {
// NewEventReader instantiates the event reader based on configuration at index
func NewEventReader(rdrCfg *config.EventReaderCfg) (er EventReader, err error) {
switch rdrCfg.Type {
default:
err = fmt.Errorf("unsupported reader type: <%s>", rdrCfg.Type)
case utils.MetaFileCSV:
}
return
}