Added InternetAccessible logic
parent
2e013b44bb
commit
00b10ac64c
|
@ -14,11 +14,13 @@ import (
|
||||||
|
|
||||||
// EdgeApp : Struct representing an EdgeApp in the system
|
// EdgeApp : Struct representing an EdgeApp in the system
|
||||||
type EdgeApp struct {
|
type EdgeApp struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Status EdgeAppStatus `json:"status"`
|
Status EdgeAppStatus `json:"status"`
|
||||||
Services []EdgeAppService `json:"services"`
|
Services []EdgeAppService `json:"services"`
|
||||||
NetworkURL string `json:"network_url"`
|
InternetAccessible bool `json:"internet_accessible"`
|
||||||
|
NetworkURL string `json:"network_url"`
|
||||||
|
InternetURL string `json:"internet_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EdgeAppStatus : Struct representing possible EdgeApp statuses (code + description)
|
// EdgeAppStatus : Struct representing possible EdgeApp statuses (code + description)
|
||||||
|
@ -35,6 +37,7 @@ type EdgeAppService struct {
|
||||||
|
|
||||||
const configFilename = "/edgebox-compose.yml"
|
const configFilename = "/edgebox-compose.yml"
|
||||||
const envFilename = "/edgebox.env"
|
const envFilename = "/edgebox.env"
|
||||||
|
const myEdgeAppServiceEnvFilename = "/myedgeapp.env"
|
||||||
const defaultContainerOperationSleepTime time.Duration = time.Second * 10
|
const defaultContainerOperationSleepTime time.Duration = time.Second * 10
|
||||||
|
|
||||||
// GetEdgeApps : Returns a list of EdgeApp struct filled with information
|
// GetEdgeApps : Returns a list of EdgeApp struct filled with information
|
||||||
|
@ -69,7 +72,26 @@ func GetEdgeApps() []EdgeApp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeApp := EdgeApp{ID: f.Name(), Name: edgeAppName, Status: GetEdgeAppStatus(f.Name()), Services: GetEdgeAppServices(f.Name()), NetworkURL: f.Name() + ".edgebox.local"}
|
edgeAppInternetAccessible := false
|
||||||
|
edgeAppInternetURL := ""
|
||||||
|
|
||||||
|
myEdgeAppServiceEnv, err := godotenv.Read(utils.GetPath("edgeAppsPath") + f.Name() + myEdgeAppServiceEnvFilename)
|
||||||
|
if err != nil {
|
||||||
|
if myEdgeAppServiceEnv["URL"] != "" {
|
||||||
|
edgeAppInternetAccessible = true
|
||||||
|
edgeAppInternetURL = myEdgeAppServiceEnv["URL"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
edgeApp := EdgeApp{
|
||||||
|
ID: f.Name(),
|
||||||
|
Name: edgeAppName,
|
||||||
|
Status: GetEdgeAppStatus(f.Name()),
|
||||||
|
Services: GetEdgeAppServices(f.Name()),
|
||||||
|
InternetAccessible: edgeAppInternetAccessible,
|
||||||
|
NetworkURL: f.Name() + ".edgebox.local",
|
||||||
|
InternetURL: edgeAppInternetURL,
|
||||||
|
}
|
||||||
edgeApps = append(edgeApps, edgeApp)
|
edgeApps = append(edgeApps, edgeApp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue