X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Fconfig.go;h=11daf4f6c9a6ee61785d08d04cad010f1d084ab8;hb=6858093cd7e4679d1687c29d15922e6d7a3a94a6;hp=8ab79418ce09d1988755d90049362b5c97d73e4e;hpb=827a6410631045b503ce098de6683c6916c09842;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/config.go b/pkg/xapp/config.go index 8ab7941..11daf4f 100755 --- a/pkg/xapp/config.go +++ b/pkg/xapp/config.go @@ -65,7 +65,7 @@ func LoadConfig() (l *Log) { updateMTypes := func() { var mtypes []mtype - viper.UnmarshalKey("rmr.mtypes", &mtypes) + viper.UnmarshalKey("messaging.mtypes", &mtypes) if len(mtypes) > 0 { l.Info("Config mtypes before RICMessageTypes:%d RicMessageTypeToName:%d", len(RICMessageTypes), len(RicMessageTypeToName)) @@ -139,6 +139,16 @@ func GetPortData(pname string) (d PortData) { return plist } + if viper.IsSet("messaging") == false { + if pname == "http" { + d.Port = 8080 + } + if pname == "rmr-data" { + d.Port = 4560 + } + return + } + for _, v := range viper.GetStringMap("messaging")["ports"].([]interface{}) { if n, ok := v.(map[string]interface{})["name"].(string); ok && n == pname { d.Name = n @@ -199,3 +209,7 @@ func (*Configurator) GetStringSlice(key string) []string { func (*Configurator) GetStringMap(key string) map[string]interface{} { return viper.GetStringMap(key) } + +func (*Configurator) IsSet(key string) bool { + return viper.IsSet(key) +}