mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
Merge pull request #433 from SecurityBrewery/server-timeout
Add server timeout
This commit is contained in:
@@ -28,7 +28,6 @@ linters:
|
|||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
- grouper
|
- grouper
|
||||||
- ifshort
|
|
||||||
- importas
|
- importas
|
||||||
- ireturn
|
- ireturn
|
||||||
- misspell
|
- misspell
|
||||||
@@ -50,6 +49,7 @@ linters:
|
|||||||
- bodyclose
|
- bodyclose
|
||||||
- contextcheck
|
- contextcheck
|
||||||
- gosimple
|
- gosimple
|
||||||
|
- ifshort
|
||||||
- nilerr
|
- nilerr
|
||||||
- noctx
|
- noctx
|
||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/arangodb/go-driver"
|
"github.com/arangodb/go-driver"
|
||||||
|
|
||||||
@@ -68,7 +69,12 @@ func main() {
|
|||||||
api.Proxy("http://localhost:8080/")(writer, request)
|
api.Proxy("http://localhost:8080/")(writer, request)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := http.ListenAndServe(fmt.Sprintf(":%d", config.Port), theCatalyst.Server); err != nil {
|
server := &http.Server{
|
||||||
|
Addr: fmt.Sprintf(":%d", config.Port),
|
||||||
|
ReadHeaderTimeout: 3 * time.Second,
|
||||||
|
Handler: theCatalyst.Server,
|
||||||
|
}
|
||||||
|
if err := server.ListenAndServe(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/SecurityBrewery/catalyst"
|
"github.com/SecurityBrewery/catalyst"
|
||||||
"github.com/SecurityBrewery/catalyst/cmd"
|
"github.com/SecurityBrewery/catalyst/cmd"
|
||||||
@@ -30,7 +31,12 @@ func main() {
|
|||||||
staticHandlerFunc := http.HandlerFunc(api.VueStatic(fsys))
|
staticHandlerFunc := http.HandlerFunc(api.VueStatic(fsys))
|
||||||
theCatalyst.Server.Get("/ui/*", http.StripPrefix("/ui", staticHandlerFunc).ServeHTTP)
|
theCatalyst.Server.Get("/ui/*", http.StripPrefix("/ui", staticHandlerFunc).ServeHTTP)
|
||||||
|
|
||||||
if err := http.ListenAndServe(fmt.Sprintf(":%d", config.Port), theCatalyst.Server); err != nil {
|
server := &http.Server{
|
||||||
|
Addr: fmt.Sprintf(":%d", config.Port),
|
||||||
|
ReadHeaderTimeout: 3 * time.Second,
|
||||||
|
Handler: theCatalyst.Server,
|
||||||
|
}
|
||||||
|
if err := server.ListenAndServe(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user