diff --git a/config/config_defaults.go b/config/config_defaults.go
index b24a5d398..79d7cf231 100755
--- a/config/config_defaults.go
+++ b/config/config_defaults.go
@@ -788,13 +788,14 @@ const CGRATES_CFG_JSON = `
},
-"loader": { // loader for tariff plans out of .csv files
- "tpid": "", // tariff plan identificator
- "data_path": "./", // path towards tariff plan files
- "disable_reverse": false, // disable reverse computing
- "field_separator": ",", // separator used in case of csv files
+"loader": { // loader for tariff plans out of .csv files
+ "tpid": "", // tariff plan identificator
+ "data_path": "./", // path towards tariff plan files
+ "disable_reverse": false, // disable reverse computing
+ "field_separator": ",", // separator used in case of csv files
"caches_conns":["*localhost"],
"scheduler_conns": ["*localhost"],
+ "gapi_credentials": ".gapi/credentials.json" // the path to the credentials for google API or the credentials.json file content
},
diff --git a/config/config_json_test.go b/config/config_json_test.go
index 0896a67cd..9728046dc 100755
--- a/config/config_json_test.go
+++ b/config/config_json_test.go
@@ -1713,18 +1713,20 @@ func TestDfDispatcherSJsonCfg(t *testing.T) {
}
func TestDfLoaderCfg(t *testing.T) {
+ cred := json.RawMessage(`".gapi/credentials.json"`)
eCfg := &LoaderCfgJson{
- Tpid: utils.StringPointer(""),
- Data_path: utils.StringPointer("./"),
- Disable_reverse: utils.BoolPointer(false),
- Field_separator: utils.StringPointer(","),
- Caches_conns: &[]string{utils.MetaLocalHost},
- Scheduler_conns: &[]string{utils.MetaLocalHost},
+ Tpid: utils.StringPointer(""),
+ Data_path: utils.StringPointer("./"),
+ Disable_reverse: utils.BoolPointer(false),
+ Field_separator: utils.StringPointer(","),
+ Caches_conns: &[]string{utils.MetaLocalHost},
+ Scheduler_conns: &[]string{utils.MetaLocalHost},
+ Gapi_credentials: &cred,
}
if cfg, err := dfCgrJsonCfg.LoaderCfgJson(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, cfg) {
- t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(eCfg), utils.ToJSON(cfg))
+ t.Errorf("Expected1: %s, received: %+v", utils.ToJSON(*eCfg), utils.ToJSON(cfg))
}
}
diff --git a/config/config_test.go b/config/config_test.go
index 6bfbb699f..879bad518 100755
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -18,6 +18,7 @@ along with this program. If not, see
package config
import (
+ "encoding/json"
"path"
"reflect"
"testing"
@@ -1501,12 +1502,13 @@ func TestCgrCfgJSONDefaultDispatcherSCfg(t *testing.T) {
func TestCgrLoaderCfgDefault(t *testing.T) {
eLdrCfg := &LoaderCgrCfg{
- TpID: "",
- DataPath: "./",
- DisableReverse: false,
- FieldSeparator: rune(utils.CSV_SEP),
- CachesConns: []string{utils.MetaLocalHost},
- SchedulerConns: []string{utils.MetaLocalHost},
+ TpID: "",
+ DataPath: "./",
+ DisableReverse: false,
+ FieldSeparator: rune(utils.CSV_SEP),
+ CachesConns: []string{utils.MetaLocalHost},
+ SchedulerConns: []string{utils.MetaLocalHost},
+ GapiCredentials: json.RawMessage(`".gapi/credentials.json"`),
}
if !reflect.DeepEqual(cgrCfg.LoaderCgrCfg(), eLdrCfg) {
t.Errorf("received: %+v, expecting: %+v", utils.ToJSON(cgrCfg.LoaderCgrCfg()), utils.ToJSON(eLdrCfg))
diff --git a/config/libconfig_json.go b/config/libconfig_json.go
index 5f98547a4..1571da964 100755
--- a/config/libconfig_json.go
+++ b/config/libconfig_json.go
@@ -18,6 +18,8 @@ along with this program. If not, see
package config
+import "encoding/json"
+
// General config section
type GeneralJsonCfg struct {
Node_id *string
@@ -497,12 +499,13 @@ type DispatcherSJsonCfg struct {
}
type LoaderCfgJson struct {
- Tpid *string
- Data_path *string
- Disable_reverse *bool
- Field_separator *string
- Caches_conns *[]string
- Scheduler_conns *[]string
+ Tpid *string
+ Data_path *string
+ Disable_reverse *bool
+ Field_separator *string
+ Caches_conns *[]string
+ Scheduler_conns *[]string
+ Gapi_credentials *json.RawMessage
}
type MigratorCfgJson struct {
diff --git a/config/loadercgrcfg.go b/config/loadercgrcfg.go
index 168c2709c..3997b77b7 100644
--- a/config/loadercgrcfg.go
+++ b/config/loadercgrcfg.go
@@ -18,15 +18,20 @@ along with this program. If not, see
package config
-import "github.com/cgrates/cgrates/utils"
+import (
+ "encoding/json"
+
+ "github.com/cgrates/cgrates/utils"
+)
type LoaderCgrCfg struct {
- TpID string
- DataPath string
- DisableReverse bool
- FieldSeparator rune // The separator to use when reading csvs
- CachesConns []string
- SchedulerConns []string
+ TpID string
+ DataPath string
+ DisableReverse bool
+ FieldSeparator rune // The separator to use when reading csvs
+ CachesConns []string
+ SchedulerConns []string
+ GapiCredentials json.RawMessage
}
func (ld *LoaderCgrCfg) loadFromJsonCfg(jsnCfg *LoaderCfgJson) (err error) {
@@ -68,5 +73,8 @@ func (ld *LoaderCgrCfg) loadFromJsonCfg(jsnCfg *LoaderCfgJson) (err error) {
}
}
}
+ if jsnCfg.Gapi_credentials != nil {
+ ld.GapiCredentials = *jsnCfg.Gapi_credentials
+ }
return nil
}
diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json
index 9358bba0e..ea5d6018a 100755
--- a/data/conf/cgrates/cgrates.json
+++ b/data/conf/cgrates/cgrates.json
@@ -394,6 +394,8 @@
// "concurrent_requests": -1, // limit the number of active requests processed by the server <-1|0-n>
// "synced_conn_requests": false, // process one request at the time per connection
// "asr_template": "", // enable AbortSession message being sent to client on DisconnectSession
+// "rar_template": "", // template used to build the Re-Auth-Request
+// "disconnect_method": "*asr", // the request to send to diameter on DisconnectSession <*asr|*rar>
// "templates":{ // default message templates
// "*err": [
// {"tag": "SessionId", "path": "*rep.Session-Id", "type": "*variable",
@@ -436,6 +438,26 @@
// "value": "~*req.User-Name", "mandatory": true},
// {"tag": "OriginStateID", "path": "*diamreq.Origin-State-Id", "type": "*constant",
// "value": "1"},
+// ],
+// "*rar": [
+// {"tag": "SessionId", "path": "*diamreq.Session-Id", "type": "*variable",
+// "value": "~*req.Session-Id", "mandatory": true},
+// {"tag": "OriginHost", "path": "*diamreq.Origin-Host", "type": "*variable",
+// "value": "~*req.Destination-Host", "mandatory": true},
+// {"tag": "OriginRealm", "path": "*diamreq.Origin-Realm", "type": "*variable",
+// "value": "~*req.Destination-Realm", "mandatory": true},
+// {"tag": "DestinationRealm", "path": "*diamreq.Destination-Realm", "type": "*variable",
+// "value": "~*req.Origin-Realm", "mandatory": true},
+// {"tag": "DestinationHost", "path": "*diamreq.Destination-Host", "type": "*variable",
+// "value": "~*req.Origin-Host", "mandatory": true},
+// {"tag": "AuthApplicationId", "path": "*diamreq.Auth-Application-Id", "type": "*variable",
+// "value": "~*vars.*appid", "mandatory": true},
+// {"tag": "UserName", "path": "*diamreq.User-Name", "type": "*variable",
+// "value": "~*req.User-Name", "mandatory": true},
+// {"tag": "OriginStateID", "path": "*diamreq.Origin-State-Id", "type": "*constant",
+// "value": "1"},
+// {"tag": "ReAuthRequestType", "path": "*diamreq.Re-Auth-Request-Type", "type": "*constant",
+// "value": "0"},
// ]
// },
// "request_processors": [ // list of processors to be applied to diameter messages
@@ -745,13 +767,14 @@
// },
-// "loader": { // loader for tariff plans out of .csv files
-// "tpid": "", // tariff plan identificator
-// "data_path": "./", // path towards tariff plan files
-// "disable_reverse": false, // disable reverse computing
-// "field_separator": ",", // separator used in case of csv files
+// "loader": { // loader for tariff plans out of .csv files
+// "tpid": "", // tariff plan identificator
+// "data_path": "./", // path towards tariff plan files
+// "disable_reverse": false, // disable reverse computing
+// "field_separator": ",", // separator used in case of csv files
// "caches_conns":["*localhost"],
// "scheduler_conns": ["*localhost"],
+// "gapi_credentials": ".gapi/credentials.json" // the path to the credentials for google API or the credentials.json file content
// },