From 8f1e292995b8ba6ea8fc00ae15dc5a17c5bea739 Mon Sep 17 00:00:00 2001 From: KoCoder Date: Tue, 2 Jun 2026 22:08:47 +0200 Subject: [PATCH] Get the port from the json config --- internal/config/config.go | 1 + main.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index b0724a9..ff52f65 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,6 +7,7 @@ import ( type Config struct { DB_URL string `json:"db_url"` + LISTEN_ON string `json:"listen_on"` TRUSTED_PROXIES []string `json:"trusted_proxies"` OTLP_ENDPOINT string `json:"otlp_endpoint"` } diff --git a/main.go b/main.go index eb880b1..3623612 100644 --- a/main.go +++ b/main.go @@ -74,12 +74,12 @@ func main() { // Use h2c so we can serve HTTP/2 without TLS. p.SetUnencryptedHTTP2(true) s := http.Server{ - Addr: ":3001", + Addr: conf.LISTEN_ON, Handler: instrumentedHandler, Protocols: p, } - slog.Info("Starting server on :3001") + slog.Info("Starting server on " + conf.LISTEN_ON) if err := s.ListenAndServe(); err != nil { slog.Error("Server failed", slog.String("err", err.Error())) }