refactor(app): moved all db and log to one intialize spot

This commit is contained in:
2025-08-04 06:54:21 -05:00
parent 486e4fb6b8
commit 0ecbe29ec1
13 changed files with 148 additions and 99 deletions

View File

@@ -13,7 +13,7 @@ import (
"lst.net/pkg/logger"
)
func Setup(db *gorm.DB, basePath string) *gin.Engine {
func Setup(db *gorm.DB, basePath string, log *logger.CustomLogger) *gin.Engine {
r := gin.Default()
if os.Getenv("APP_ENV") == "production" {
@@ -45,9 +45,9 @@ func Setup(db *gorm.DB, basePath string) *gin.Engine {
})
// all routes to there respective systems.
ws.RegisterSocketRoutes(r, basePath)
settings.RegisterSettingsRoutes(r, basePath)
servers.RegisterServersRoutes(r, basePath)
ws.RegisterSocketRoutes(r, basePath, log, db)
settings.RegisterSettingsRoutes(r, basePath, log, db)
servers.RegisterServersRoutes(r, basePath, log, db)
r.Any(basePath+"/api", errorApiLoc)