From dd539fe80538f27697113360e33a1f9c063559e0 Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Fri, 26 Aug 2022 14:47:44 -0400 Subject: [PATCH] fix: teapot --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 12d799c..5287b3a 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "io/ioutil" + "embed" "net/http" "path" "time" @@ -20,6 +20,9 @@ import ( "github.com/penguin-statistics/widget-backend/utils" ) +//go:embed misc/teapot +var teapot embed.FS + var l = utils.NewLogger("main") func init() { @@ -157,7 +160,7 @@ func main() { // very important to implement. without this the server won't behave normally. (of course not) :D e.Any("/_teapot", func(c echo.Context) error { - b, err := ioutil.ReadFile("misc/teapot") + b, err := teapot.ReadFile("misc/teapot") if err != nil { return c.JSON(render.JSONError(errors.New("TeapotNotFound", "cannot get teapot due to server failure :(", errors.BlameServer))) }