Enable Gin debug mode in development

Use USE_EMBEDDED=false environment variable (set by air) to switch
between DebugMode (dev) and ReleaseMode (production).
This commit is contained in:
Christoph Haas 2026-03-26 01:01:52 +01:00
parent 6b0e91798f
commit 21a2ffbd44

View file

@ -105,9 +105,14 @@ func main() {
// The frontend is compiled into the binary during build time.
frontendFS := FrontendFileSystem()
// Set Gin to release mode for production.
// This disables debug logging and other development features.
// Set Gin mode based on environment.
// USE_EMBEDDED=false means development mode (e.g., via air hot-reloader).
// Release mode disables debug logging and other development features.
if os.Getenv("USE_EMBEDDED") == "false" {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
// Create a new Gin engine (router).
engine := gin.New()