diff --git a/docker-compose.yml b/docker-compose.yml index 69d004f..919275c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: container_name: shelfy-go working_dir: /app ports: - - "8090:8083" + - "8090:8080" - "2121:2121" # si tu gardes FTP - "30000-30100:30000-30100" # si tu gardes FTP - "2222:2222" # SFTP diff --git a/main.go b/main.go index d168702..1955d6d 100644 --- a/main.go +++ b/main.go @@ -234,20 +234,28 @@ func startSFTPServer(base string) { func startHTTP() { bd := db.InitDB() - app := gin.Default() - api := app.Group("/api/v1") - routes.AddRoutes(api, bd) - utils.CreateDefaultFolder(bd) - app.Static("/static", "./web") - app.NoRoute(func(c *gin.Context) { - if strings.HasPrefix(c.Request.URL.Path, "/api/") { - c.JSON(404, gin.H{"error": "Not found"}) - return + app := gin.Default() + + api := app.Group("/api/v1") + routes.AddRoutes(api, bd) + utils.CreateDefaultFolder(bd) + + app.Static("/static", "./web") + app.NoRoute(func(c *gin.Context) { + if strings.HasPrefix(c.Request.URL.Path, "/api/") { + c.JSON(404, gin.H{"error": "Not found"}) + return } - c.File("./web/index.html") }) - log.Println("[HTTP] Serveur Gin sur http://localhost:8083") - app.Run(":8083") + c.File("./web/index.html") + }) + + addr := ":8080" // ⚠️ si LocalAI tourne déjà sur 8080, change par ":8082" + log.Printf("[HTTP] Serveur Gin sur http://0.0.0.0%s", addr) + if err := app.Run(addr); err != nil { + log.Fatalf("[HTTP] Erreur lancement: %v", err) } +} + func main() { // SFTP sur 2222 (root = ./upload)