Renamed module database into tasks

This commit is contained in:
Paulo Truta
2021-02-13 16:06:13 +01:00
parent 375bb03dfe
commit 8845cb11de
6 changed files with 33 additions and 18 deletions
+12 -4
View File
@@ -9,8 +9,8 @@ import (
"syscall"
"time"
"github.com/edgebox-iot/sysctl/internal/database"
"github.com/edgebox-iot/sysctl/internal/diagnostics"
"github.com/edgebox-iot/sysctl/internal/tasks"
)
func main() {
@@ -18,7 +18,8 @@ func main() {
// load command line arguments
version := flag.Bool("version", false, "Get the version info")
name := flag.String("name", "edgebox", "name for the service")
db := flag.Bool("database", false, "Get database connection info")
name := flag.String("name", "edgebox", "Name for the service")
flag.Parse()
@@ -27,6 +28,11 @@ func main() {
os.Exit(0)
}
if *db {
printDbDetails()
os.Exit(0)
}
log.Printf("Starting Sysctl service for %s", *name)
// setup signal catching
@@ -47,8 +53,10 @@ func main() {
}()
printVersion()
printDbDetails()
dbQueryResult := database.PerformQuery()
dbQueryResult := tasks.PerformQuery()
log.Printf("Query result: %s", dbQueryResult)
// infinite loop
@@ -75,7 +83,7 @@ func printVersion() {
func printDbDetails() {
fmt.Printf(
"\n\nDatabase Connection Information:\nHost: %s\nuser: %s\npassword: %s\n\n",
database.Dbhost, database.Dbuser, database.Dbpass,
tasks.Dbhost, tasks.Dbuser, tasks.Dbpass,
)
}