From c1e3f20b6e9f0fe69c4b5c59b5f039aa81e250a9 Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Tue, 19 May 2026 18:38:10 -0400 Subject: [PATCH 1/5] fix: vet-clean Fatalf format strings in servers/server.go --- servers/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/servers/server.go b/servers/server.go index 54711cf..7ecaed7 100644 --- a/servers/server.go +++ b/servers/server.go @@ -136,7 +136,7 @@ func (server *MicroServer) Start() { httpL, err := net.Listen("tcp", "0.0.0.0:11000") if err != nil { - Error.Fatalf("Failed to listen on %s: %w", server.addr, err) + Error.Fatalf("Failed to listen on %s: %v", server.addr, err) } ds := setupDatasource() @@ -180,7 +180,7 @@ func servGRPC(server *MicroServer, lis net.Listener, grpcOpts []grpc.ServerOptio milpacs.RegisterTicketsServiceServer(server.grpcServer, ticketsService) if err := server.grpcServer.Serve(lis); err != nil { - Error.Fatalf("unable to start external gRPC servers: ", err) + Error.Fatalf("unable to start external gRPC servers: %v", err) } } @@ -188,7 +188,7 @@ func servHTTP(server *MicroServer, lis net.Listener, ds datastores.Datastore) { service := httpServices.Service{Address: server.addr, Cache: server.cache, Datastore: ds} server.httpServer = service.Server() if err := server.httpServer.Serve(lis); err != nil { - Error.Fatalf("unable to start HTTP servers: ", err) + Error.Fatalf("unable to start HTTP servers: %v", err) } } From 30d8548ae584878629a6b83ac690b33faf2b8b8f Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Tue, 19 May 2026 18:38:40 -0400 Subject: [PATCH 2/5] fix: tighten tickets cache-bypass to exact path or trailing slash --- middleware/cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/cache.go b/middleware/cache.go index 97dd5b1..b3717ed 100644 --- a/middleware/cache.go +++ b/middleware/cache.go @@ -19,7 +19,7 @@ var ( func CacheMiddleware(cache *cache.RedisCache, next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if strings.HasPrefix(r.URL.Path, "/api/v1/tickets") { + if r.URL.Path == "/api/v1/tickets" || strings.HasPrefix(r.URL.Path, "/api/v1/tickets/") { next.ServeHTTP(w, r) return } From a16dd5d7c806c432f04b4ae13cc1e201271b7c82 Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Tue, 19 May 2026 18:40:14 -0400 Subject: [PATCH 3/5] feat: allow empty REDIS_PASSWORD for local-dev no-AUTH Redis --- servers/server.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/servers/server.go b/servers/server.go index 7ecaed7..2812910 100644 --- a/servers/server.go +++ b/servers/server.go @@ -80,8 +80,7 @@ func setupRedis() *cache.RedisCache { redisPassword := viper.GetString("REDIS_PASSWORD") if redisPassword == "" { - Error.Println("no redis password provided") - os.Exit(1) + Info.Println("REDIS_PASSWORD empty — connecting without AUTH") } return cache.NewRedisCache(redisHost, redisPort, redisPassword) From 57d7d55b355cae21da99ec5a562fb48d65f3e232 Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Tue, 19 May 2026 18:47:24 -0400 Subject: [PATCH 4/5] docs: clarify PORT is the gateway-to-grpc dial target, not a listen port --- cmd/serve.go | 4 ++++ servers/server.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cmd/serve.go b/cmd/serve.go index 031ac3f..7af55b1 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -30,6 +30,10 @@ var serveCmd = &cobra.Command{ Use: "serve", Short: "Launches the api servers", Run: func(cmd *cobra.Command, args []string) { + // PORT is the loopback port the HTTP gateway dials to reach the in-process gRPC server. + // It is NOT a listen port: both the gRPC server (:10000) and HTTP gateway (:11000) listen + // ports are hardcoded in servers/server.go. PORT must match the hardcoded gRPC port (10000) + // for the gateway-to-gRPC dial to succeed. server := servers.New(fmt.Sprintf("0.0.0.0:%s", viper.GetString("port"))) server.Start() }, diff --git a/servers/server.go b/servers/server.go index 2812910..7dffb2e 100644 --- a/servers/server.go +++ b/servers/server.go @@ -52,6 +52,8 @@ type MicroServer struct { } // New initializes a new Backend struct. +// addr is the gRPC dial target consumed by the HTTP gateway (from $PORT); not a listen address. +// The gRPC and HTTP listen ports are hardcoded literals in Start(). func New(addr string) *MicroServer { return &MicroServer{ From 25ecca9fc52cef06a1402d0d4e761a92e52c4131 Mon Sep 17 00:00:00 2001 From: SyniRon <66834451+SyniRon@users.noreply.github.com> Date: Tue, 19 May 2026 18:54:21 -0400 Subject: [PATCH 5/5] docs: drop misleading loopback wording and rewrite PORT note for accuracy Co-Authored-By: Claude Sonnet 4.6 --- cmd/serve.go | 2 +- servers/server.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/serve.go b/cmd/serve.go index 7af55b1..1a1a74a 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -30,7 +30,7 @@ var serveCmd = &cobra.Command{ Use: "serve", Short: "Launches the api servers", Run: func(cmd *cobra.Command, args []string) { - // PORT is the loopback port the HTTP gateway dials to reach the in-process gRPC server. + // PORT is the port the HTTP gateway dials to reach the in-process gRPC server. // It is NOT a listen port: both the gRPC server (:10000) and HTTP gateway (:11000) listen // ports are hardcoded in servers/server.go. PORT must match the hardcoded gRPC port (10000) // for the gateway-to-gRPC dial to succeed. diff --git a/servers/server.go b/servers/server.go index 7dffb2e..b1ccd9b 100644 --- a/servers/server.go +++ b/servers/server.go @@ -52,8 +52,9 @@ type MicroServer struct { } // New initializes a new Backend struct. -// addr is the gRPC dial target consumed by the HTTP gateway (from $PORT); not a listen address. -// The gRPC and HTTP listen ports are hardcoded literals in Start(). +// addr is the gRPC dial target consumed by the HTTP gateway (from $PORT). +// Listen ports for both gRPC (:10000) and HTTP (:11000) are hardcoded in Start(); +// addr must match the gRPC literal for the gateway-to-gRPC dial to succeed. func New(addr string) *MicroServer { return &MicroServer{