[WIP] Support for cloud version (#17)

* Added build-cloud to Makefile

* Fix env var key GOOS

* Added taskSetReleaseVersion for edgeboxctl version option write into DB

* taskGetSystemUptime to run every 5 ticks

* Added support for detecting main disk in cloud version

* Added missing import

* Finding main device in test

* Refactored GetDevices and test to use release_version

* Added utils.getIP function, set to run as a 60 tick scheduled task

* Added taskEnablePublicDashboard and taskDisablePublicDashboard

* Added utils.WriteOption and refactor, added enablePublicDashb0oard

* Finalizing online support for dashboard, cloud version support

* Added task SetupCloudOptions

* Added couple of func description comments

* Early return statement (thanks @inverse)

* Using IsPublicDashboard in DisablePublicDashboard func

* Added constants for release version and device types, added diagnostics.GetReleaseVersion

* Removed codecov from test action
This commit is contained in:
Paulo Truta
2022-02-06 15:37:50 +01:00
committed by GitHub
parent 864d1e8f0f
commit 83d2fdcae1
10 changed files with 311 additions and 122 deletions
+31
View File
@@ -335,6 +335,37 @@ func DisableOnline(ID string) MaybeEdgeApp {
}
func EnablePublicDashboard(InternetURL string) bool {
envFilePath := utils.GetPath("apiPath") + myEdgeAppServiceEnvFilename
env, _ := godotenv.Unmarshal("INTERNET_URL=" + InternetURL)
_ = godotenv.Write(env, envFilePath)
buildFrameworkContainers()
return true
}
func DisablePublicDashboard() bool {
envFilePath := utils.GetPath("apiPath") + myEdgeAppServiceEnvFilename
if !IsPublicDashboard() {
log.Println("myedge.app environment file for the dashboard / api not found. No need to delete.")
return false
}
cmdArgs := []string{envFilePath}
utils.Exec(utils.GetPath("apiPath"), "rm", cmdArgs)
buildFrameworkContainers()
return true
}
func IsPublicDashboard() bool {
envFilePath := utils.GetPath("apiPath") + myEdgeAppServiceEnvFilename
_, err := godotenv.Read(envFilePath)
return err == nil
}
func buildFrameworkContainers() {
cmdArgs := []string{utils.GetPath("wsPath") + "ws", "--build"}