about summary refs log tree commit diff stats
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/server/server.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 4692965..71b9199 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -6,6 +6,7 @@ import (
 	"net"
 	"net/http"
 	"net/url"
+	"os"
 	"slices"
 	"time"
 
@@ -145,7 +146,15 @@ func New(runtimeConfig *Config) (*Server, error) {
 }
 
 func (s *Server) Start() error {
-	if err := s.ListenAndServe(); err != http.ErrServerClosed {
+	f := os.NewFile(uintptr(3), "")
+	l, err := net.FileListener(f)
+	if err != nil {
+		l, err = net.Listen("tcp", s.Addr)
+		if err != nil {
+			return errors.Wrap(err, "could not create listener")
+		}
+	}
+	if err := http.Serve(l, s.Handler); err != http.ErrServerClosed {
 		return errors.Wrap(err, "error creating/closing server")
 	}