Rename "configs" to "configs_url"

This commit is contained in:
TeoV
2020-09-04 12:52:40 +03:00
committed by Dan Christian Bogos
parent cb191792e1
commit 07d72e2076
8 changed files with 14 additions and 14 deletions

View File

@@ -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)

View File

@@ -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
}

View File

@@ -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
},

View File

@@ -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)

View File

@@ -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,
}
}

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -1949,7 +1949,7 @@ const (
HTTPCDRsURLCfg = "http_cdrs"
HTTPUseBasicAuthCfg = "use_basic_auth"
HTTPAuthUsersCfg = "auth_users"
Configs = "configs"
ConfigsURL = "configs_url"
)
// FilterSCfg