This commit is contained in:
parent
72d23c35f5
commit
302491741f
@ -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"
|
@ -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",
|
||||
|
@ -24,14 +24,10 @@ 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 {
|
||||
// Handle normal http request
|
||||
return makeHypertextResponse(c, dest)
|
||||
}
|
||||
// TODO Impl SSE with https://github.com/gofiber/recipes/blob/master/sse/main.go
|
||||
|
||||
// Handle normal http request
|
||||
return makeHypertextResponse(c, dest)
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user