feat: Added gorm.io/gorm and gorm.io/driver/sqlite dependencies, initialized service registry database with SQLite backend
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user