Fixes with .env file handling and other misc
parent
7857985fe4
commit
5e81525635
|
@ -75,6 +75,8 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
|
||||||
|
|
||||||
myEdgeAppServiceEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + ID + myEdgeAppServiceEnvFilename)
|
myEdgeAppServiceEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + ID + myEdgeAppServiceEnvFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println("No myedge.app environment file found. Status is Network-Only")
|
||||||
|
} else {
|
||||||
if myEdgeAppServiceEnv["INTERNET_URL"] != "" {
|
if myEdgeAppServiceEnv["INTERNET_URL"] != "" {
|
||||||
edgeAppInternetAccessible = true
|
edgeAppInternetAccessible = true
|
||||||
edgeAppInternetURL = myEdgeAppServiceEnv["INTERNET_URL"]
|
edgeAppInternetURL = myEdgeAppServiceEnv["INTERNET_URL"]
|
||||||
|
@ -248,6 +250,8 @@ func DisableOnline(ID string) MaybeEdgeApp {
|
||||||
envFilePath := utils.GetPath("edgeAppsPath") + ID + myEdgeAppServiceEnvFilename
|
envFilePath := utils.GetPath("edgeAppsPath") + ID + myEdgeAppServiceEnvFilename
|
||||||
_, err := godotenv.Read(envFilePath)
|
_, err := godotenv.Read(envFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println("myedge.app environment file for " + ID + " not found. No need to delete.")
|
||||||
|
} else {
|
||||||
cmdArgs := []string{envFilePath}
|
cmdArgs := []string{envFilePath}
|
||||||
utils.Exec("rm", cmdArgs)
|
utils.Exec("rm", cmdArgs)
|
||||||
}
|
}
|
||||||
|
@ -260,8 +264,8 @@ func DisableOnline(ID string) MaybeEdgeApp {
|
||||||
|
|
||||||
func buildFrameworkContainers() {
|
func buildFrameworkContainers() {
|
||||||
|
|
||||||
cmdArgs := []string{"--build"}
|
cmdArgs := []string{utils.GetPath("wsPath") + "ws", "--build"}
|
||||||
utils.Exec("./"+utils.GetPath("wsPath")+"/ws", cmdArgs)
|
utils.Exec("sh", cmdArgs)
|
||||||
|
|
||||||
time.Sleep(defaultContainerOperationSleepTime)
|
time.Sleep(defaultContainerOperationSleepTime)
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ func taskEnableOnline(args taskEnableOnlineArgs) string {
|
||||||
|
|
||||||
func taskDisableOnline(args taskDisableOnlineArgs) string {
|
func taskDisableOnline(args taskDisableOnlineArgs) string {
|
||||||
|
|
||||||
fmt.Println("Executing taskEnableOnline for " + args.ID)
|
fmt.Println("Executing taskDisableOnline for " + args.ID)
|
||||||
|
|
||||||
result := edgeapps.DisableOnline(args.ID)
|
result := edgeapps.DisableOnline(args.ID)
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,13 +16,14 @@ func Exec(command string, args []string) string {
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
|
cmd.Dir = GetPath("wsPath")
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: Deal with possibility of error in command, allow explicit error handling and return proper formatted stderr
|
// TODO: Deal with possibility of error in command, allow explicit error handling and return proper formatted stderr
|
||||||
// log.Println(fmt.Sprint(err) + ": " + stderr.String()) // ... Silence...
|
log.Println(fmt.Sprint(err) + ": " + stderr.String()) // ... Silence...
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.Println("Result: " + out.String()) // ... Silence ...
|
log.Println("Result: " + out.String()) // ... Silence ...
|
||||||
|
|
||||||
return out.String()
|
return out.String()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue