Commit edd5ce86 authored by Simon Pastor's avatar Simon Pastor
Browse files

update

parent 6d3bbce1
Loading
Loading
Loading
Loading
+710 −1485

File changed.

Preview size limit exceeded, changes collapsed.

+711 −1468

File changed.

Preview size limit exceeded, changes collapsed.

+0 −72
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020  InterDigital Communications, Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package main

import (
	"errors"
	"net/url"
	"os"
	"strings"

	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
)

const serviceName = "MEP"

var hostUrl *url.URL
var sandboxName string

// Init - EPAE Service initialization
func Init() (err error) {

	// Retrieve Sandbox name from environment variable
	sandboxNameEnv := strings.TrimSpace(os.Getenv("MEEP_SANDBOX_NAME"))
	if sandboxNameEnv != "" {
		sandboxName = sandboxNameEnv
	}
	if sandboxName == "" {
		err = errors.New("MEEP_SANDBOX_NAME env variable not set")
		log.Error(err.Error())
		return err
	}
	log.Info("MEEP_SANDBOX_NAME: ", sandboxName)

	// hostUrl is the url of the node serving the resourceURL
	// Retrieve public url address where service is reachable, if not present, use Host URL environment variable
	hostUrl, err = url.Parse(strings.TrimSpace(os.Getenv("MEEP_PUBLIC_URL")))
	if err != nil || hostUrl == nil || hostUrl.String() == "" {
		hostUrl, err = url.Parse(strings.TrimSpace(os.Getenv("MEEP_HOST_URL")))
		if err != nil {
			hostUrl = new(url.URL)
		}
	}
	log.Info("resource URL: ", hostUrl)

	reInit()

	return nil
}

// reInit - finds the value already in the DB to repopulate local stored info
func reInit() {
}

// Run - Start EPAE 
func Run() (err error) {
	//return sbi.Run()
	return nil
}
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 2.1.1
- Build date: 2021-05-06T10:52:40.924-04:00[America/New_York]
- Build date: 2021-05-06T13:48:07.656-04:00[America/New_York]


### Running the server
+0 −105
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020  InterDigital Communications, Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package server

import (
	//"bytes"
	//"encoding/json"
	"errors"
	//"fmt"
	//"io/ioutil"
	//"net/http"
	"net/url"
	"os"
	//"strconv"
	"strings"
	//"sync"
	//"time"

	//dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr"
	//httpLog "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-http-logger"
	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
	//met "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metrics"
	//redis "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis"
	//"github.com/gorilla/mux"
)

//const rnisBasePath = "/rni/v1/"
//const epaeKey = "epae:"
//const logModuleEPAE = "meep-edge-platform-app-enablement"
const serviceName = "Edge Platform Application Enablement Service"

//var metricStore *met.MetricStore

//var redisAddr string = "meep-redis-master.default.svc.cluster.local:6379"
//var influxAddr string = "http://meep-influxdb.default.svc.cluster.local:8086"

//var EPAE_DB = 1

//var rc *redis.Connector
var hostUrl *url.URL
var sandboxName string

//var basePath string
//var baseKey string
//var mutex sync.Mutex
/*
func notImplemented(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusNotImplemented)
}
*/
// Init - EPAE Service initialization
func Init() (err error) {

	// Retrieve Sandbox name from environment variable
	sandboxNameEnv := strings.TrimSpace(os.Getenv("MEEP_SANDBOX_NAME"))
	if sandboxNameEnv != "" {
		sandboxName = sandboxNameEnv
	}
	if sandboxName == "" {
		err = errors.New("MEEP_SANDBOX_NAME env variable not set")
		log.Error(err.Error())
		return err
	}
	log.Info("MEEP_SANDBOX_NAME: ", sandboxName)

	// hostUrl is the url of the node serving the resourceURL
	// Retrieve public url address where service is reachable, if not present, use Host URL environment variable
	hostUrl, err = url.Parse(strings.TrimSpace(os.Getenv("MEEP_PUBLIC_URL")))
	if err != nil || hostUrl == nil || hostUrl.String() == "" {
		hostUrl, err = url.Parse(strings.TrimSpace(os.Getenv("MEEP_HOST_URL")))
		if err != nil {
			hostUrl = new(url.URL)
		}
	}
	log.Info("resource URL: ", hostUrl)

	reInit()

	return nil
}

// reInit - finds the value already in the DB to repopulate local stored info
func reInit() {
}

// Run - Start RNIS
func Run() (err error) {
	//return sbi.Run()
	return nil
}
Loading