feat: Added gorm.io/gorm and gorm.io/driver/sqlite dependencies, initialized service registry database with SQLite backend

This commit is contained in:
2025-02-11 15:42:09 +01:00
parent a4f70d0376
commit 9d4c10b392
7 changed files with 69 additions and 0 deletions

View File

@@ -1,10 +1,23 @@
package generalnode
import (
"github.com/alexohneander/flotte/pkg/models"
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
func Start() {
// Init Service Registry Database
db, err := gorm.Open(sqlite.Open("flotte.db"), &gorm.Config{})
if err != nil {
panic("failed to connect database")
}
// Migrate the schema
db.AutoMigrate(&models.Service{})
// Init API Backend
router := gin.Default()
router = registerRoutes(router)