chore: configure gin mode
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
2bdad13e5c
commit
ab4f905725
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
// NewRouter builds a Gin engine with all API routes registered.
|
||||
func NewRouter(workspaces *service.WorkspaceService, files *service.FileService, processes *service.ProcessService, lg *slog.Logger) *gin.Engine {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
func NewRouter(workspaces *service.WorkspaceService, files *service.FileService, processes *service.ProcessService, lg *slog.Logger, ginMode string) *gin.Engine {
|
||||
gin.SetMode(ginMode)
|
||||
r := gin.New()
|
||||
r.Use(gin.Recovery())
|
||||
r.Use(requestLogger(lg))
|
||||
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
"codespace/internal/process"
|
||||
"codespace/internal/service"
|
||||
"codespace/internal/workspace"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func setupTestRouter(t *testing.T) http.Handler {
|
||||
@@ -25,7 +27,7 @@ func setupTestRouterWithMaxWriteBytes(t *testing.T, maxWriteBytes int64) http.Ha
|
||||
wsSvc := service.NewWorkspaceService(wsMgr, procMgr, nil)
|
||||
fileSvc := service.NewFileService(wsMgr, maxWriteBytes)
|
||||
procSvc := service.NewProcessService(wsMgr, procMgr, nil)
|
||||
return NewRouter(wsSvc, fileSvc, procSvc, nil)
|
||||
return NewRouter(wsSvc, fileSvc, procSvc, nil, gin.TestMode)
|
||||
}
|
||||
|
||||
func createWorkspaceForTest(t *testing.T, router http.Handler, id string) {
|
||||
|
||||
Reference in New Issue
Block a user