Skip to content

Commit caefdd8

Browse files
committed
chore: embed reaper
1 parent 8ffffe8 commit caefdd8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

api.go

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package main
22

33
import (
44
"bufio"
5+
"embed"
6+
"io/fs"
57
"net"
68
"net/http"
79
"os"
@@ -13,6 +15,9 @@ import (
1315
"gopkg.in/gin-contrib/cors.v1"
1416
)
1517

18+
//go:embed dashboard/reaper
19+
var dashboardAssets embed.FS
20+
1621
func isRunningInDockerContainer() bool {
1722
// slightly modified from blog: https://paulbradley.org/indocker/
1823
// docker creates a .dockerenv file at the root
@@ -53,6 +58,14 @@ func StartAPIServer(config *Config,
5358

5459
router.Use(cors.Default())
5560

61+
router.GET("/", func(c *gin.Context) {
62+
c.Redirect(http.StatusTemporaryRedirect, "/dashboard")
63+
c.Abort()
64+
})
65+
66+
dashboardAssets, _ := fs.Sub(dashboardAssets, "dashboard/reaper")
67+
router.StaticFS("/dashboard", http.FS(dashboardAssets))
68+
5669
router.GET("/blockcache", func(c *gin.Context) {
5770
special := make([]string, 0, len(blockCache.Special))
5871
for k := range blockCache.Special {

0 commit comments

Comments
 (0)