X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=mep%2Fmepagent%2Fpkg%2Fservice%2Fregister.go;h=5dd6dc35664c30c650850f7671e2bf059206c6e1;hb=ee49b4a131a219cc4951abe7c7ecb5914addd3dc;hp=934157471c61295613466193f0a2e2fcf90f1dcc;hpb=54b1432860d4a0843b75378f68bcb3eba56ba9a8;p=ealt-edge.git diff --git a/mep/mepagent/pkg/service/register.go b/mep/mepagent/pkg/service/register.go index 9341574..5dd6dc3 100644 --- a/mep/mepagent/pkg/service/register.go +++ b/mep/mepagent/pkg/service/register.go @@ -19,11 +19,15 @@ package service import ( "encoding/json" "log" + "os" "strconv" "time" ) func SvcReg(confPath string) (string, error) { + var urlProto string + var gwPORT string + conf, err := GetConf(confPath) if err != nil { log.Println(err.Error()) @@ -32,9 +36,21 @@ func SvcReg(confPath string) (string, error) { appInstanceId := conf.AppInstanceId serviceInfos := conf.ServiceInfoPosts - mepServerIP := conf.MepServerIP - mepServerPORT := conf.MepServerPORT - url := "http://" + mepServerIP + ":" + mepServerPORT + "/mep/mec_service_mgmt/v1/applications/" + appInstanceId + "/services" + gwRoutes := conf.MepGWROUTES + gwIP := conf.MepGWIP + + sslMode := os.Getenv("APP_SSL_MODE") + //if ssl mode is enabled, then config tls + if sslMode == "0" { + gwPORT = conf.HttpGWPORT + urlProto = "http://" + } else { + gwPORT = conf.HttpsGWPORT + urlProto = "https://" + } + + url := urlProto + gwIP + ":" + gwPORT + gwRoutes + "/mep/mec_service_mgmt/v1/applications/" + appInstanceId + "/services" + log.Println("Register url is" + url) for _, serviceInfo := range serviceInfos { data, e := json.Marshal(serviceInfo)