diff --git a/cmd/rio/main.go b/cmd/rio/main.go index fba71f7..ac15f77 100644 --- a/cmd/rio/main.go +++ b/cmd/rio/main.go @@ -210,16 +210,6 @@ func runServer(ctx *cli.Context) error { 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 cacheCtx := context.CacheContext{ RepositoryInformationCache: context.MakeRepoInfoCache(), @@ -310,6 +300,16 @@ func runServer(ctx *cli.Context) error { }() 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() { defer waitGroup.Done()