Embedding frontend via Pkger
This commit is contained in:
parent
8187085e39
commit
1ddb4febe8
5 changed files with 50 additions and 1 deletions
6
app.go
6
app.go
|
@ -3,8 +3,10 @@ package headscale
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/markbates/pkger"
|
||||
|
||||
"github.com/tailscale/wireguard-go/wgcfg"
|
||||
)
|
||||
|
@ -58,6 +60,10 @@ func (h *Headscale) Serve() error {
|
|||
r.GET("/register", h.RegisterWebAPI)
|
||||
r.POST("/machine/:id/map", h.PollNetMapHandler)
|
||||
r.POST("/machine/:id", h.RegistrationHandler)
|
||||
|
||||
// r.LoadHTMLFiles("./frontend/build/index.html")
|
||||
// r.Use(static.Serve("/", static.LocalFile("./frontend/build", true)))
|
||||
r.Use(gin.WrapH(http.FileServer(pkger.Dir("/frontend/build"))))
|
||||
err := r.Run(h.cfg.Addr)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue