From 081eb3fc3208da55a6124670ed166a469b69fe6f Mon Sep 17 00:00:00 2001 From: Julien Brochet Date: Mon, 16 Sep 2024 13:14:30 +0200 Subject: [PATCH] feat: add possibility to specify server host address --- cmd/riverui/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/riverui/main.go b/cmd/riverui/main.go index 4298f0a7..d05ad848 100644 --- a/cmd/riverui/main.go +++ b/cmd/riverui/main.go @@ -58,6 +58,7 @@ func initAndServe(ctx context.Context) int { corsOrigins := strings.Split(corsOriginString, ",") dbURL := mustEnv("DATABASE_URL") otelEnabled := os.Getenv("OTEL_ENABLED") == "true" + host := os.Getenv("HOST") port := os.Getenv("PORT") if port == "" { port = "8080" @@ -109,7 +110,7 @@ func initAndServe(ctx context.Context) int { wrappedHandler := sloghttp.NewWithConfig(logger, config)(corsHandler.Handler(logHandler)) srv := &http.Server{ - Addr: ":" + port, + Addr: host + ":" + port, Handler: wrappedHandler, ReadHeaderTimeout: 5 * time.Second, }