mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-25 14:20:56 +02:00
Added database module with exportable functions
This commit is contained in:
+15
-2
@@ -6,9 +6,10 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/edgebox-iot/sysctl/internal/database"
|
||||
"github.com/edgebox-iot/sysctl/internal/diagnostics"
|
||||
)
|
||||
|
||||
@@ -45,6 +46,11 @@ func main() {
|
||||
os.Exit(1)
|
||||
}()
|
||||
|
||||
printVersion()
|
||||
printDbDetails()
|
||||
dbQueryResult := database.PerformQuery()
|
||||
log.Printf("Query result: %s", dbQueryResult)
|
||||
|
||||
// infinite loop
|
||||
for {
|
||||
|
||||
@@ -61,11 +67,18 @@ func appCleanup() {
|
||||
|
||||
func printVersion() {
|
||||
fmt.Printf(
|
||||
"version: %s\ncommit: %s\nbuild time: %s",
|
||||
"\nversion: %s\ncommit: %s\nbuild time: %s\n",
|
||||
diagnostics.Version, diagnostics.Commit, diagnostics.BuildDate,
|
||||
)
|
||||
}
|
||||
|
||||
func printDbDetails() {
|
||||
fmt.Printf(
|
||||
"\n\nDatabase Connection Information:\nHost: %s\nuser: %s\npassword: %s\n\n",
|
||||
database.Dbhost, database.Dbuser, database.Dbpass,
|
||||
)
|
||||
}
|
||||
|
||||
// IsSystemReady : Checks hability of the service to execute commands (Only after "edgebox --build" is ran at least once via SSH, or if built for distribution)
|
||||
func isSystemReady() bool {
|
||||
_, err := os.Stat("/home/system/components/ws")
|
||||
|
||||
Reference in New Issue
Block a user