Logger
All checks were successful
release-nightly / build-docker (push) Successful in 1m1s

This commit is contained in:
2023-11-25 23:06:23 +08:00
parent ad3b36bc2a
commit 3dab1dbd46
3 changed files with 34 additions and 3 deletions

View File

@ -1,13 +1,15 @@
package hypertext
import (
roadsign "code.smartsheep.studio/goatworks/roadsign/pkg"
"fmt"
"time"
roadsign "code.smartsheep.studio/goatworks/roadsign/pkg"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/limiter"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"time"
)
func InitServer() *fiber.App {
@ -20,6 +22,11 @@ func InitServer() *fiber.App {
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
})
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Proxies] [${time}] ${status} - ${latency} ${method} ${path}\n",
}))
if viper.GetInt("hypertext.limitation.max_qps") > 0 {
app.Use(limiter.New(limiter.Config{
Max: viper.GetInt("hypertext.limitation.max_qps"),