X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fxapp%2Fxapp.go;h=0ae9b02c0e51a8c017bda4f0d1124b0e5818bdb7;hb=refs%2Ftags%2Fv0.4.7;hp=b63c8aae2fb9c4a0e80313ba552c3825ba4c555a;hpb=9f08bbc4a4ae33fcde424535af185423007240e0;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/xapp/xapp.go b/pkg/xapp/xapp.go index b63c8aa..0ae9b02 100755 --- a/pkg/xapp/xapp.go +++ b/pkg/xapp/xapp.go @@ -52,6 +52,8 @@ func SetReadyCB(cb ReadyCB, params interface{}) { } func xappReadyCb(params interface{}) { + Alarm = NewAlarmClient(viper.GetString("alarm.MOId"), viper.GetString("alarm.APPId")) + if readyCb != nil { readyCb(readyCbParams) } @@ -66,14 +68,13 @@ func init() { Config = Configurator{} Metric = NewMetrics(viper.GetString("metrics.url"), viper.GetString("metrics.namespace"), Resource.router) Subscription = NewSubscriber(viper.GetString("subscription.host"), viper.GetInt("subscription.timeout")) - Alarm = NewAlarmClient(viper.GetString("alarm.MOId"), viper.GetString("alarm.APPId")) if viper.IsSet("db.namespaces") { namespaces := viper.GetStringSlice("db.namespaces") - if namespaces[0] != "" { + if len(namespaces) > 0 && namespaces[0] != "" { Sdl = NewSDLClient(viper.GetStringSlice("db.namespaces")[0]) } - if namespaces[1] != "" { + if len(namespaces) > 1 && namespaces[1] != "" { Rnib = NewRNIBClient(viper.GetStringSlice("db.namespaces")[1]) } } else {