From 1270bbf4bda2d39d8ced51e51edfc5a5c8d74efb Mon Sep 17 00:00:00 2001 From: Yash Dhawan Date: Thu, 14 May 2026 08:55:59 +0530 Subject: [PATCH] extract hardcoded proxy ports as named constants --- src/backend/config/config.go | 10 ++++++++-- src/backend/server/server.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/backend/config/config.go b/src/backend/config/config.go index 9115d17..4bd33bf 100644 --- a/src/backend/config/config.go +++ b/src/backend/config/config.go @@ -14,6 +14,12 @@ import ( "github.com/hannes/kiji-private/src/backend/providers" ) +// DefaultForwardProxyPort is the default port for the forward proxy. +const DefaultForwardProxyPort = ":8080" + +// DefaultTransparentProxyPort is the default port for the transparent proxy. +const DefaultTransparentProxyPort = ":8081" + // LoggingConfig holds logging configuration options type LoggingConfig struct { LogRequests bool // Log request content @@ -242,7 +248,7 @@ func DefaultConfig() *Config { MistralProviderConfig: defaultMistralProviderConfig, CustomProviderConfig: defaultCustomProviderConfig, }, - ProxyPort: ":8080", + ProxyPort: DefaultForwardProxyPort, ONNXModelPath: "", TokenizerPath: "", ModelVariant: ModelVariantTrained, @@ -261,7 +267,7 @@ func DefaultConfig() *Config { }, Proxy: ProxyConfig{ TransparentEnabled: true, - ProxyPort: ":8081", + ProxyPort: DefaultTransparentProxyPort, CAPath: caPath, KeyPath: keyPath, EnablePAC: true, // Enable PAC by default for automatic proxy configuration diff --git a/src/backend/server/server.go b/src/backend/server/server.go index ba1cec0..25ba419 100644 --- a/src/backend/server/server.go +++ b/src/backend/server/server.go @@ -307,7 +307,7 @@ func (s *Server) Start() error { func (s *Server) startTransparentProxy() { proxyPort := s.config.Proxy.ProxyPort if proxyPort == "" { - proxyPort = ":8080" + proxyPort = config.DefaultForwardProxyPort } log.Printf("Starting transparent proxy on port %s", proxyPort)