feat(app): changes to dyanmically load systems based on settings
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"lst.net/internal/db"
|
||||
"lst.net/internal/router"
|
||||
"lst.net/internal/system/settings"
|
||||
"lst.net/pkg/logger"
|
||||
)
|
||||
|
||||
@@ -43,6 +44,12 @@ func main() {
|
||||
}
|
||||
}()
|
||||
|
||||
if err := settings.Initialize(db.DB); err != nil {
|
||||
log.Panic("There was an error intilizing the settings", "settings", map[string]interface{}{
|
||||
"error": err,
|
||||
})
|
||||
}
|
||||
|
||||
// long lived process like ocp running all the time should go here and base the db struct over.
|
||||
// go ocp.MonitorPrinters
|
||||
// go notifcations.Processor
|
||||
@@ -54,8 +61,7 @@ func main() {
|
||||
basePath = "/lst" // Dev only
|
||||
}
|
||||
|
||||
fmt.Println("Welcome to lst backend where all the fun happens.")
|
||||
|
||||
log.Info("Welcome to lst backend where all the fun happens.", "system", map[string]interface{}{})
|
||||
// Init Gin router and pass DB to services
|
||||
r := router.Setup(db.DB, basePath, log)
|
||||
|
||||
@@ -66,7 +72,6 @@ func main() {
|
||||
}
|
||||
|
||||
if err := r.Run(":" + port); err != nil {
|
||||
log := logger.New()
|
||||
log.Panic("Server failed to start", "system", map[string]interface{}{
|
||||
"error": err,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user