mirror of
https://github.com/project-zot/zot.git
synced 2025-01-20 22:52:51 -05:00
server: add idle timeout in http server configuration
This commit is contained in:
parent
e73aed99be
commit
3c88102870
1 changed files with 10 additions and 1 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/anuvu/zot/errors"
|
||||
ext "github.com/anuvu/zot/pkg/extensions"
|
||||
|
@ -17,6 +18,10 @@ import (
|
|||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
const (
|
||||
idleTimeout = 120 * time.Second
|
||||
)
|
||||
|
||||
type Controller struct {
|
||||
Config *Config
|
||||
Router *mux.Router
|
||||
|
@ -60,7 +65,11 @@ func (c *Controller) Run() error {
|
|||
_ = NewRouteHandler(c)
|
||||
|
||||
addr := fmt.Sprintf("%s:%s", c.Config.HTTP.Address, c.Config.HTTP.Port)
|
||||
server := &http.Server{Addr: addr, Handler: c.Router}
|
||||
server := &http.Server{
|
||||
Addr: addr,
|
||||
Handler: c.Router,
|
||||
IdleTimeout: idleTimeout,
|
||||
}
|
||||
c.Server = server
|
||||
|
||||
// Create the listener
|
||||
|
|
Loading…
Add table
Reference in a new issue