fix pipe closed issue, and a lot of other stuff

This commit is contained in:
Zoe
2024-12-14 02:49:05 -06:00
parent 7689999413
commit de22bd20c9
23 changed files with 1032 additions and 795 deletions

View File

@@ -1,15 +1,16 @@
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"github.com/juls0730/flux/server"
"go.uber.org/zap"
)
func main() {
fluxServer := server.NewServer()
defer fluxServer.Stop()
http.HandleFunc("POST /deploy", fluxServer.DeployHandler)
http.HandleFunc("DELETE /deployments", fluxServer.DeleteAllDeploymentsHandler)
@@ -19,6 +20,9 @@ func main() {
http.HandleFunc("GET /apps", fluxServer.ListAppsHandler)
http.HandleFunc("GET /heartbeat", fluxServer.DaemonInfoHandler)
log.Printf("Fluxd started on http://127.0.0.1:5647\n")
log.Fatal(http.ListenAndServe(":5647", nil))
fluxServer.Logger.Info("Fluxd started on http://127.0.0.1:5647")
err := http.ListenAndServe(":5647", nil)
if err != nil {
fluxServer.Logger.Fatalf("Failed to start server: %v", zap.Error(err))
}
}