mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-08-30 02:58:47 +00:00
Make healthcheck port configurable (#1197)
Closes https://github.com/woodpecker-ci/woodpecker/issues/1193 Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
1d47da647b
commit
d28080a9eb
@ -17,6 +17,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -89,7 +90,7 @@ func loop(c *cli.Context) error {
|
|||||||
|
|
||||||
if c.Bool("healthcheck") {
|
if c.Bool("healthcheck") {
|
||||||
go func() {
|
go func() {
|
||||||
if err := http.ListenAndServe(":3000", nil); err != nil {
|
if err := http.ListenAndServe(fmt.Sprintf(":%d", c.Int("healthcheck-port")), nil); err != nil {
|
||||||
log.Error().Msgf("can not listen on port 3000: %v", err)
|
log.Error().Msgf("can not listen on port 3000: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -89,6 +89,12 @@ var flags = []cli.Flag{
|
|||||||
Usage: "enable healthcheck endpoint",
|
Usage: "enable healthcheck endpoint",
|
||||||
Value: true,
|
Value: true,
|
||||||
},
|
},
|
||||||
|
&cli.IntFlag{
|
||||||
|
EnvVars: []string{"WOODPECKER_HEALTHCHECK_PORT"},
|
||||||
|
Name: "healthcheck-port",
|
||||||
|
Usage: "port used for healthcheck endpoint",
|
||||||
|
Value: 3000,
|
||||||
|
},
|
||||||
&cli.DurationFlag{
|
&cli.DurationFlag{
|
||||||
EnvVars: []string{"WOODPECKER_KEEPALIVE_TIME"},
|
EnvVars: []string{"WOODPECKER_KEEPALIVE_TIME"},
|
||||||
Name: "keepalive-time",
|
Name: "keepalive-time",
|
||||||
|
Loading…
Reference in New Issue
Block a user