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 container_name: shelfy-go
working_dir: /app working_dir: /app
ports: ports:
- "8090:8083" - "8090:8080"
- "2121:2121" # si tu gardes FTP - "2121:2121" # si tu gardes FTP
- "30000-30100:30000-30100" # si tu gardes FTP - "30000-30100:30000-30100" # si tu gardes FTP
- "2222:2222" # SFTP - "2222:2222" # SFTP

14
main.go
View File

@ -235,19 +235,27 @@ func startSFTPServer(base string) {
func startHTTP() { func startHTTP() {
bd := db.InitDB() bd := db.InitDB()
app := gin.Default() app := gin.Default()
api := app.Group("/api/v1") api := app.Group("/api/v1")
routes.AddRoutes(api, bd) routes.AddRoutes(api, bd)
utils.CreateDefaultFolder(bd) utils.CreateDefaultFolder(bd)
app.Static("/static", "./web") app.Static("/static", "./web")
app.NoRoute(func(c *gin.Context) { app.NoRoute(func(c *gin.Context) {
if strings.HasPrefix(c.Request.URL.Path, "/api/") { if strings.HasPrefix(c.Request.URL.Path, "/api/") {
c.JSON(404, gin.H{"error": "Not found"}) c.JSON(404, gin.H{"error": "Not found"})
return return
} }
c.File("./web/index.html") }) c.File("./web/index.html")
log.Println("[HTTP] Serveur Gin sur http://localhost:8083") })
app.Run(":8083")
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() { func main() {
// SFTP sur 2222 (root = ./upload) // SFTP sur 2222 (root = ./upload)