This commit is contained in:
cangui 2025-08-18 18:20:06 +02:00
parent 907d21f03a
commit 7aa9448887
2 changed files with 21 additions and 13 deletions

View File

@ -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

14
main.go
View File

@ -235,19 +235,27 @@ 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
}
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)