Commit e259b416 authored by ale's avatar ale
Browse files

Add command-line option to set request timeout

parent 6cde90b8
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"time"
"git.autistici.org/ai3/go-common/unix" "git.autistici.org/ai3/go-common/unix"
"github.com/coreos/go-systemd/daemon" "github.com/coreos/go-systemd/daemon"
...@@ -21,6 +22,7 @@ var ( ...@@ -21,6 +22,7 @@ var (
socketPath = flag.String("socket", "/run/auth/socket", "`path` to the UNIX socket to listen on") socketPath = flag.String("socket", "/run/auth/socket", "`path` to the UNIX socket to listen on")
systemdSocketActivation = flag.Bool("systemd-socket", false, "use SystemD socket activation") systemdSocketActivation = flag.Bool("systemd-socket", false, "use SystemD socket activation")
httpAddr = flag.String("http-addr", "", "if not nil, bind an HTTP server to this `addr` for Prometheus metrics") httpAddr = flag.String("http-addr", "", "if not nil, bind an HTTP server to this `addr` for Prometheus metrics")
requestTimeout = flag.Duration("timeout", 5*time.Second, "timeout for incoming requests")
) )
func usage() { func usage() {
...@@ -58,6 +60,7 @@ func main() { ...@@ -58,6 +60,7 @@ func main() {
} }
srv := unix.NewLineServer(server.NewSocketServer(authSrv)) srv := unix.NewLineServer(server.NewSocketServer(authSrv))
srv.RequestTimeout = *requestTimeout
var sockSrv *unix.SocketServer var sockSrv *unix.SocketServer
if *systemdSocketActivation { if *systemdSocketActivation {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment