diff --git a/pkg/config/config.go b/pkg/config/config.go index 5e4cb8181..1d507234b 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -744,7 +744,7 @@ func (c *ModelConfig) SetAPIKey(value string) { type GatewayConfig struct { Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"` - Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"` + Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT,PORT"` APIKey string `json:"api_key" env:"PICOCLAW_GATEWAY_API_KEY"` ChatEnabled bool `json:"chat_enabled" env:"PICOCLAW_GATEWAY_CHAT_ENABLED"` HotReload bool `json:"hot_reload" env:"PICOCLAW_GATEWAY_HOT_RELOAD"` diff --git a/pkg/health/server.go b/pkg/health/server.go index baa401afd..9b4bc45c5 100644 --- a/pkg/health/server.go +++ b/pkg/health/server.go @@ -63,6 +63,11 @@ type StatusResponse struct { } func NewServer(host string, port int) *Server { + if envPort := os.Getenv("PORT"); envPort != "" { + if _, err := fmt.Sscanf(envPort, "%d", &port); err == nil { + logger.Infof("Overriding server port with PORT environment variable: %d", port) + } + } mux := http.NewServeMux() s := &Server{ ready: false, @@ -75,7 +80,6 @@ func NewServer(host string, port int) *Server { mux.HandleFunc("/ready", s.readyHandler) mux.HandleFunc("/reload", s.reloadHandler) mux.HandleFunc("/chat", s.chatHandler) - mux.HandleFunc("/cgat", s.chatHandler) // Start task cleanup goroutine go s.taskCleanupLoop() @@ -280,7 +284,6 @@ func (s *Server) RegisterOnMux(mux HandlerMux) { mux.HandleFunc("/ready", s.readyHandler) mux.HandleFunc("/reload", s.reloadHandler) mux.HandleFunc("/chat", s.chatHandler) - mux.HandleFunc("/cgat", s.chatHandler) mux.HandleFunc("/v1/chat/completions", func(w http.ResponseWriter, r *http.Request) { logger.Error("GATEWAY IS HITTING ITSELF FOR LLM CALLS!") http.Error(w, "GATEWAY LOOP DETECTION", http.StatusLoopDetected)