Merge pull request #9 from edgebox-iot/edgeapp_description_support

Added support for adding EDGEAPP_DESCRIPTION env var to edgebox.env
pull/10/head
Paulo Truta 2021-06-01 16:51:48 +02:00 committed by GitHub
commit 5d69a9fb22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 6 deletions

View File

@ -16,6 +16,7 @@ import (
type EdgeApp struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Status EdgeAppStatus `json:"status"`
Services []EdgeAppService `json:"services"`
InternetAccessible bool `json:"internet_accessible"`
@ -60,6 +61,7 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
// File exists. Start digging!
edgeAppName := ID
edgeAppDescription := ""
edgeAppEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + ID + envFilename)
@ -69,6 +71,9 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
if edgeAppEnv["EDGEAPP_NAME"] != "" {
edgeAppName = edgeAppEnv["EDGEAPP_NAME"]
}
if edgeAppEnv["EDGEAPP_DESCRIPTION"] != "" {
edgeAppDescription = edgeAppEnv["EDGEAPP_DESCRIPTION"]
}
}
edgeAppInternetAccessible := false
@ -88,6 +93,7 @@ func GetEdgeApp(ID string) MaybeEdgeApp {
EdgeApp: EdgeApp{
ID: ID,
Name: edgeAppName,
Description: edgeAppDescription,
Status: GetEdgeAppStatus(ID),
Services: GetEdgeAppServices(ID),
InternetAccessible: edgeAppInternetAccessible,
@ -123,7 +129,6 @@ func SetEdgeAppInstalled(ID string) bool {
_, err := os.Stat(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
if os.IsNotExist(err) {
_, err := os.Create(utils.GetPath("edgeAppsPath") + ID + runnableFilename)
result = true
@ -134,7 +139,6 @@ func SetEdgeAppInstalled(ID string) bool {
buildFrameworkContainers()
} else {
// Is already installed.