From 07d72e20761129b68a16e839e55e296a64b5d513 Mon Sep 17 00:00:00 2001 From: TeoV Date: Fri, 4 Sep 2020 12:52:40 +0300 Subject: [PATCH] Rename "configs" to "configs_url" --- cmd/cgr-engine/cgr-engine.go | 4 ++-- config/config.go | 4 ++-- config/config_defaults.go | 2 +- config/config_json_test.go | 2 +- config/httpcfg.go | 8 ++++---- config/httpcfg_test.go | 4 ++-- config/libconfig_json.go | 2 +- utils/consts.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index 37fcfde2c..1420ad9c7 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -508,8 +508,8 @@ func main() { if len(cfg.HTTPCfg().DispatchersRegistrarURL) != 0 { server.RegisterHttpFunc(cfg.HTTPCfg().DispatchersRegistrarURL, dispatcherh.Registar) } - if len(cfg.HTTPCfg().Configs) != 0 { - server.RegisterHttpFunc(cfg.HTTPCfg().Configs, config.HandlerConfigS) + if len(cfg.HTTPCfg().ConfigsURL) != 0 { + server.RegisterHttpFunc(cfg.HTTPCfg().ConfigsURL, config.HandlerConfigS) } if *httpPprofPath != "" { go server.RegisterProfiler(*httpPprofPath) diff --git a/config/config.go b/config/config.go index 1ea455c11..bc2c1a0b9 100755 --- a/config/config.go +++ b/config/config.go @@ -1656,7 +1656,7 @@ func handleConfigSFolder(path string, w http.ResponseWriter) { // convert the config into a json and send it if _, err := w.Write([]byte(utils.ToJSON(cfg.AsMapInterface(cfg.generalCfg.RSRSep)))); err != nil { utils.Logger.Warning(fmt.Sprintf("<%s> Failed to write resonse because: %s", - utils.Configs, err)) + utils.ConfigSv1, err)) } return } @@ -1671,7 +1671,7 @@ func handleConfigSFile(path string, w http.ResponseWriter) { } if _, err := w.Write(dat); err != nil { utils.Logger.Warning(fmt.Sprintf("<%s> Failed to write resonse because: %s", - utils.Configs, err)) + utils.ConfigSv1, err)) } return } diff --git a/config/config_defaults.go b/config/config_defaults.go index d2d0aad74..ce3d70022 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -185,7 +185,7 @@ const CGRATES_CFG_JSON = ` "http_cdrs": "/cdr_http", // CDRS relative URL ("" to disable) "use_basic_auth": false, // use basic authentication "auth_users": {}, // basic authentication usernames and base64-encoded passwords (eg: { "username1": "cGFzc3dvcmQ=", "username2": "cGFzc3dvcmQy "}) - "configs": "/configs/" // configs + "configs_url": "/configs/" // configs }, diff --git a/config/config_json_test.go b/config/config_json_test.go index f740f9aad..5d5a2e69f 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -1557,7 +1557,7 @@ func TestDfHttpJsonCfg(t *testing.T) { Http_Cdrs: utils.StringPointer("/cdr_http"), Use_basic_auth: utils.BoolPointer(false), Auth_users: utils.MapStringStringPointer(map[string]string{}), - Configs: utils.StringPointer("/configs/"), + Configs_url: utils.StringPointer("/configs/"), } if cfg, err := dfCgrJSONCfg.HttpJsonCfg(); err != nil { t.Error(err) diff --git a/config/httpcfg.go b/config/httpcfg.go index c0fdf2be7..331c99fca 100644 --- a/config/httpcfg.go +++ b/config/httpcfg.go @@ -29,7 +29,7 @@ type HTTPCfg struct { HTTPCDRsURL string // CDRS relative URL ("" to disable) HTTPUseBasicAuth bool // Use basic auth for HTTP API HTTPAuthUsers map[string]string // Basic auth user:password map (base64 passwords) - Configs string + ConfigsURL string } //loadFromJsonCfg loads Database config from JsonCfg @@ -58,8 +58,8 @@ func (httpcfg *HTTPCfg) loadFromJsonCfg(jsnHttpCfg *HTTPJsonCfg) (err error) { if jsnHttpCfg.Auth_users != nil { httpcfg.HTTPAuthUsers = *jsnHttpCfg.Auth_users } - if jsnHttpCfg.Configs != nil { - httpcfg.Configs = *jsnHttpCfg.Configs + if jsnHttpCfg.Configs_url != nil { + httpcfg.ConfigsURL = *jsnHttpCfg.Configs_url } return nil @@ -79,6 +79,6 @@ func (httpcfg *HTTPCfg) AsMapInterface() map[string]interface{} { utils.HTTPCDRsURLCfg: httpcfg.HTTPCDRsURL, utils.HTTPUseBasicAuthCfg: httpcfg.HTTPUseBasicAuth, utils.HTTPAuthUsersCfg: httpUsers, - utils.Configs: httpcfg.Configs, + utils.ConfigsURL: httpcfg.ConfigsURL, } } diff --git a/config/httpcfg_test.go b/config/httpcfg_test.go index 9af7613dc..85df0925c 100644 --- a/config/httpcfg_test.go +++ b/config/httpcfg_test.go @@ -76,7 +76,7 @@ func TestHTTPCfgAsMapInterface(t *testing.T) { "http_cdrs": "/cdr_http", "use_basic_auth": false, "auth_users": {}, - "configs": "/configs" + "configs_url": "/configs/" }, }` @@ -88,7 +88,7 @@ func TestHTTPCfgAsMapInterface(t *testing.T) { "http_cdrs": "/cdr_http", "use_basic_auth": false, "auth_users": map[string]interface{}{}, - "configs": "/configs", + "configs_url": "/configs/", } if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil { diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 44ca7196a..c058059e8 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -71,7 +71,7 @@ type HTTPJsonCfg struct { Http_Cdrs *string Use_basic_auth *bool Auth_users *map[string]string - Configs *string + Configs_url *string } type TlsJsonCfg struct { diff --git a/utils/consts.go b/utils/consts.go index fd7348d29..9d186a74f 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -1949,7 +1949,7 @@ const ( HTTPCDRsURLCfg = "http_cdrs" HTTPUseBasicAuthCfg = "use_basic_auth" HTTPAuthUsersCfg = "auth_users" - Configs = "configs" + ConfigsURL = "configs_url" ) // FilterSCfg