Commit 8447fb13 authored by Simon Pastor's avatar Simon Pastor
Browse files

add default of localhost for hostUrl but notification might not work in services since unreachable

parent f818cb64
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -41,14 +41,16 @@ func init() {
	//create client
	locServAppClientCfg := locServClient.NewConfiguration()
	if hostUrlStr == "" {
		locServAppClientCfg.BasePath = "http://localhost/" + sandboxName + "/location/v2"
	} else {
		locServAppClientCfg.BasePath = hostUrlStr + "/" + sandboxName + "/location/v2"
		hostUrlStr = "http://localhost"
	}

	locServAppClientCfg.BasePath = hostUrlStr + "/" + sandboxName + "/location/v2"

	locServAppClient = locServClient.NewAPIClient(locServAppClientCfg)
	if locServAppClient == nil {
		log.Error("Failed to create Location App REST API client: ", locServAppClientCfg.BasePath)
	}
	//NOTE: if localhost is set as the hostUrl, might not be reachable from the service, export MEEP_HOST_TEST_URL ="http://[yourhost]"
	locServServerUrl = hostUrlStr + ":" + httpListenerPort

	//enable gis engine mobility, poas-in-range and netchar update
+13 −12
Original line number Diff line number Diff line
@@ -67,17 +67,21 @@ func initialiseVars() {

	hostUrl, _ := url.Parse(strings.TrimSpace(os.Getenv("MEEP_HOST_TEST_URL")))
	hostUrlStr = hostUrl.String()
        if hostUrlStr == "" {
                hostUrlStr = "http://localhost"
        }
}

func createClients() error {

	// Create & store client for App REST API
	platformCtrlAppClientCfg := platformCtrlClient.NewConfiguration()

	if hostUrlStr == "" {
		platformCtrlAppClientCfg.BasePath = "http://localhost/platform-ctrl/v1"
	} else {
		platformCtrlAppClientCfg.BasePath = hostUrlStr + "/platform-ctrl/v1"
                hostUrlStr = "http://localhost"
        }
	platformCtrlAppClientCfg.BasePath = hostUrlStr + "/platform-ctrl/v1"

	platformCtrlAppClient = platformCtrlClient.NewAPIClient(platformCtrlAppClientCfg)
	if platformCtrlAppClient == nil {
		log.Error("Failed to create Platform App REST API client: ", platformCtrlAppClientCfg.BasePath)
@@ -92,10 +96,10 @@ func createSandboxClients(sandboxName string) error {
	// Create & store client for App REST API
	sandboxCtrlAppClientCfg := sandboxCtrlClient.NewConfiguration()
	if hostUrlStr == "" {
		sandboxCtrlAppClientCfg.BasePath = "http://localhost/" + sandboxName + "/sandbox-ctrl/v1"
	} else {
		sandboxCtrlAppClientCfg.BasePath = hostUrlStr + "/" + sandboxName + "/sandbox-ctrl/v1"
		hostUrlStr = "http://localhost"
	}
	sandboxCtrlAppClientCfg.BasePath = hostUrlStr + "/" + sandboxName + "/sandbox-ctrl/v1"

	sandboxCtrlAppClient = sandboxCtrlClient.NewAPIClient(sandboxCtrlAppClientCfg)
	if sandboxCtrlAppClient == nil {
		log.Error("Failed to create Sandbox App REST API client: ", sandboxCtrlAppClientCfg.BasePath)
@@ -104,11 +108,8 @@ func createSandboxClients(sandboxName string) error {
	}

	gisAppClientCfg := gisClient.NewConfiguration()
	if hostUrlStr == "" {
		gisAppClientCfg.BasePath = "http://localhost/" + sandboxName + "/gis/v1"
	} else {
	gisAppClientCfg.BasePath = hostUrlStr + "/" + sandboxName + "/gis/v1"
	}

	gisAppClient = gisClient.NewAPIClient(gisAppClientCfg)
	if gisAppClient == nil {
		log.Error("Failed to create GIS App REST API client: ", gisAppClientCfg.BasePath)