Skip to content

Commit

Permalink
fix: teapot
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Aug 26, 2022
1 parent 6adcd6c commit dd539fe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"embed"
"net/http"
"path"
"time"
Expand All @@ -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() {
Expand Down Expand Up @@ -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)))
}
Expand Down

0 comments on commit dd539fe

Please sign in to comment.