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:
parent
6b0e91798f
commit
21a2ffbd44
1 changed files with 8 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue