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:
qwerty287 2022-09-19 00:07:37 +02:00 committed by GitHub
parent 1d47da647b
commit d28080a9eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -17,6 +17,7 @@ package main
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"runtime"
@ -89,7 +90,7 @@ func loop(c *cli.Context) error {
if c.Bool("healthcheck") {
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)
}
}()

View file

@ -89,6 +89,12 @@ var flags = []cli.Flag{
Usage: "enable healthcheck endpoint",
Value: true,
},
&cli.IntFlag{
EnvVars: []string{"WOODPECKER_HEALTHCHECK_PORT"},
Name: "healthcheck-port",
Usage: "port used for healthcheck endpoint",
Value: 3000,
},
&cli.DurationFlag{
EnvVars: []string{"WOODPECKER_KEEPALIVE_TIME"},
Name: "keepalive-time",