feat: Only listen on http-port if we don't have ACME disabled
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
PapaTutuWawa 2024-02-04 13:41:29 +01:00
parent aaab500049
commit 4b4bc9792b

View File

@ -210,16 +210,6 @@ func runServer(ctx *cli.Context) error {
return err return err
} }
// Listen on the HTTP port
httpAddr := ctx.String("http-host") + ":" + ctx.String("http-port")
httpListener, err := net.Listen("tcp", httpAddr)
if err != nil {
fmt.Println(
fmt.Errorf("Failed to create HTTP listener: %v", err),
)
return err
}
// Prepare the context // Prepare the context
cacheCtx := context.CacheContext{ cacheCtx := context.CacheContext{
RepositoryInformationCache: context.MakeRepoInfoCache(), RepositoryInformationCache: context.MakeRepoInfoCache(),
@ -310,6 +300,16 @@ func runServer(ctx *cli.Context) error {
}() }()
if !acmeDisable { if !acmeDisable {
// Listen on the HTTP port
httpAddr := ctx.String("http-host") + ":" + ctx.String("http-port")
httpListener, err := net.Listen("tcp", httpAddr)
if err != nil {
fmt.Println(
fmt.Errorf("Failed to create HTTP listener: %v", err),
)
return err
}
go func() { go func() {
defer waitGroup.Done() defer waitGroup.Done()