"github.com/go-openapi/strfmt"
"github.com/spf13/viper"
"io/ioutil"
+ "net"
"net/http"
- "strings"
+ "os"
"time"
apiclient "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi"
func NewSubscriber(host string, timo int) *Subscriber {
if host == "" {
- host = "service-ricplt-submgr-http:8088"
+ pltnamespace := os.Getenv("PLT_NAMESPACE")
+ if pltnamespace == "" {
+ pltnamespace = "ricplt"
+ }
+ host = fmt.Sprintf("service-%s-submgr-http.%s:8088", pltnamespace, pltnamespace)
}
if timo == 0 {
return err
}
- port := strings.Split(viper.GetString("local.host"), ":")[1]
- clientUrl := fmt.Sprintf("http://%s:%s%s", clientEndpoint, port, r.clientUrl)
+ ep, _, _ := net.SplitHostPort(clientEndpoint)
+ _, port, _ := net.SplitHostPort(fmt.Sprintf(":%d", GetPortData("http").Port))
+ clientUrl := fmt.Sprintf("http://%s:%s%s", ep, port, r.clientUrl)
retries := viper.GetInt("subscription.retryCount")
if retries == 0 {