Added support for adding EDGEAPP_DESCRIPTION env var to edgebox.env edgeapps
parent
1ad554b9bf
commit
3ef90ffb15
|
@ -16,6 +16,7 @@ import (
|
||||||
type EdgeApp struct {
|
type EdgeApp struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
Status EdgeAppStatus `json:"status"`
|
Status EdgeAppStatus `json:"status"`
|
||||||
Services []EdgeAppService `json:"services"`
|
Services []EdgeAppService `json:"services"`
|
||||||
InternetAccessible bool `json:"internet_accessible"`
|
InternetAccessible bool `json:"internet_accessible"`
|
||||||
|
@ -60,6 +61,7 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
|
||||||
// File exists. Start digging!
|
// File exists. Start digging!
|
||||||
|
|
||||||
edgeAppName := ID
|
edgeAppName := ID
|
||||||
|
edgeAppDescription := ""
|
||||||
|
|
||||||
edgeAppEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + ID + envFilename)
|
edgeAppEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + ID + envFilename)
|
||||||
|
|
||||||
|
@ -69,6 +71,9 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
|
||||||
if edgeAppEnv["EDGEAPP_NAME"] != "" {
|
if edgeAppEnv["EDGEAPP_NAME"] != "" {
|
||||||
edgeAppName = edgeAppEnv["EDGEAPP_NAME"]
|
edgeAppName = edgeAppEnv["EDGEAPP_NAME"]
|
||||||
}
|
}
|
||||||
|
if edgeAppEnv["EDGEAPP_DESCRIPTION"] != "" {
|
||||||
|
edgeAppDescription = edgeAppEnv["EDGEAPP_DESCRIPTION"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeAppInternetAccessible := false
|
edgeAppInternetAccessible := false
|
||||||
|
@ -88,6 +93,7 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
|
||||||
EdgeApp: EdgeApp{
|
EdgeApp: EdgeApp{
|
||||||
ID: ID,
|
ID: ID,
|
||||||
Name: edgeAppName,
|
Name: edgeAppName,
|
||||||
|
Description: edgeAppDescription,
|
||||||
Status: GetEdgeAppStatus(ID),
|
Status: GetEdgeAppStatus(ID),
|
||||||
Services: GetEdgeAppServices(ID),
|
Services: GetEdgeAppServices(ID),
|
||||||
InternetAccessible: edgeAppInternetAccessible,
|
InternetAccessible: edgeAppInternetAccessible,
|
||||||
|
@ -123,7 +129,6 @@ func SetEdgeAppInstalled(ID string) bool {
|
||||||
_, err := os.Stat(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
_, err := os.Stat(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
||||||
|
|
||||||
_, err := os.Create(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
_, err := os.Create(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
|
@ -134,7 +139,6 @@ func SetEdgeAppInstalled(ID string) bool {
|
||||||
|
|
||||||
buildFrameworkContainers()
|
buildFrameworkContainers()
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Is already installed.
|
// Is already installed.
|
||||||
|
@ -151,9 +155,9 @@ func SetEdgeAppNotInstalled(ID string) bool {
|
||||||
result := true
|
result := true
|
||||||
err := os.Remove(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
err := os.Remove(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = false
|
result = false
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFrameworkContainers()
|
buildFrameworkContainers()
|
||||||
|
|
||||||
|
@ -201,7 +205,7 @@ func GetEdgeAppStatus(ID string) EdgeAppStatus {
|
||||||
// - No service running = EdgeApp is off
|
// - No service running = EdgeApp is off
|
||||||
|
|
||||||
runningServices := 0
|
runningServices := 0
|
||||||
|
|
||||||
status := EdgeAppStatus{0, "off"}
|
status := EdgeAppStatus{0, "off"}
|
||||||
|
|
||||||
if !IsEdgeAppInstalled(ID) {
|
if !IsEdgeAppInstalled(ID) {
|
||||||
|
|
Loading…
Reference in New Issue