package web import ( "context" "embed" "fmt" "net/http" "git.clustercockpit.org/moebiusband/go-http-skeleton/internal/util" "github.com/benbjohnson/hashfs" ) //go:embed static/* var staticFS embed.FS var staticSys = hashfs.NewFS(staticFS) func RunBlocking(port int) util.CtxErrFunc { return func(ctx context.Context) error { r := http.NewServeMux() setupRoutes(r) srv := &http.Server{ Addr: fmt.Sprintf(":%d", port), Handler: r, } go func() { <-ctx.Done() srv.Shutdown(context.Background()) }() return srv.ListenAndServe() } }