feat: rename project from Fonu to Havline
CI / verify (push) Canceled after 0s

This commit is contained in:
2026-10-01 16:54:35 +08:00
parent c377405696
commit 8fa5d922ac
250 changed files with 6724 additions and 5070 deletions
+54
View File
@@ -0,0 +1,54 @@
package main
import (
"context"
"embed"
"errors"
"io/fs"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"github.com/havline/havline/internal/app"
"github.com/havline/havline/internal/config"
)
//go:embed all:web/dist
var webDist embed.FS
func main() {
cfg := config.Load()
migrationsDir, err := app.ResolveMigrationsDir()
if err != nil {
log.Fatalf("resolve migrations: %v", err)
}
staticFS, err := fs.Sub(webDist, "web/dist")
if err != nil {
log.Fatalf("load static files: %v", err)
}
application, err := app.New(cfg, staticFS, migrationsDir)
if err != nil {
log.Fatalf("start application: %v", err)
}
go func() {
if err := application.Run(); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatalf("server error: %v", err)
}
}()
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
<-stop
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
if err := application.Shutdown(ctx); err != nil {
log.Printf("shutdown error: %v", err)
}
}