🐛 Bug fixes
Some checks are pending
release-nightly / build-docker (push) Waiting to run

This commit is contained in:
LittleSheep 2024-01-26 15:31:19 +08:00
parent 72d23c35f5
commit 302491741f
4 changed files with 20 additions and 29 deletions

View File

@ -8,24 +8,24 @@ path = ["/ws"]
id = "example-websocket-destination"
uri = "http://localhost:8765"
[[locations]]
id = "example-warden"
host = ["localhost:4321"]
path = ["/"]
[[locations.destinations]]
id = "example-warden-destination"
uri = "http://localhost:4321"
# [[locations]]
# id = "example-warden"
# host = ["localhost:4321"]
# path = ["/"]
# [[locations.destinations]]
# id = "example-warden-destination"
# uri = "http://localhost:4321"
[[applications]]
id = "example-warden-app"
workdir = "test/data/warden"
command = ["node", "dist/server/entry.mjs"]
environment = ["PUBLIC_CMS=https://smartsheep.studio"]
# [[applications]]
# id = "example-warden-app"
# workdir = "test/data/warden"
# command = ["node", "dist/server/entry.mjs"]
# environment = ["PUBLIC_CMS=https://smartsheep.studio"]
[[locations]]
id = "example-static"
host = ["localhost:8000"]
path = ["/roadsign"]
path = ["/"]
[[locations.destinations]]
id = "example-static-destination"
uri = "files://test/data"

View File

@ -24,7 +24,7 @@ func InitServer() *fiber.App {
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
})
if viper.GetBool("performance.request_logging") {
if viper.GetBool("telemetry.request_logging") {
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Proxies] [${time}] ${status} - ${latency} ${method} ${path}\n",
@ -47,7 +47,7 @@ func RunServer(app *fiber.App, ports []string, securedPorts []string, pem string
for _, port := range ports {
port := port
go func() {
if viper.GetBool("hypertext.certificate.redirect") {
if viper.GetBool("hypertext.redirect_to_https") {
redirector := fiber.New(fiber.Config{
AppName: "RoadSign",
ServerHeader: "RoadSign",

View File

@ -24,16 +24,12 @@ func makeUnifiedResponse(c *fiber.Ctx, dest *Destination) error {
// Handle websocket
return makeWebsocketResponse(c, dest)
} else {
_, queries := dest.GetRawUri()
if len(queries.Get("sse")) > 0 {
// Handle server-side event
return makeSeverSideEventResponse(c, dest)
} else {
// TODO Impl SSE with https://github.com/gofiber/recipes/blob/master/sse/main.go
// Handle normal http request
return makeHypertextResponse(c, dest)
}
}
}
func makeHypertextResponse(c *fiber.Ctx, dest *Destination) error {
timeout := time.Duration(viper.GetInt64("performance.network_timeout")) * time.Millisecond
@ -98,11 +94,6 @@ func makeWebsocketResponse(c *fiber.Ctx, dest *Destination) error {
})
}
func makeSeverSideEventResponse(c *fiber.Ctx, dest *Destination) error {
// TODO Impl SSE with https://github.com/gofiber/recipes/blob/master/sse/main.go
return fiber.NewError(fiber.StatusNotImplemented, "Server-side-events was not available now.")
}
func makeFileResponse(c *fiber.Ctx, dest *Destination) error {
uri, queries := dest.GetRawUri()
root := http.Dir(uri)

View File

@ -29,7 +29,7 @@ func InitSideload() *fiber.App {
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
})
if viper.GetBool("performance.request_logging") {
if viper.GetBool("telemetry.request_logging") {
app.Use(logger.New(logger.Config{
Output: log.Logger,
Format: "[Sideload] [${time}] ${status} - ${latency} ${method} ${path}\n",