Fixed Bugs

* Fixed gin release mode
- Removed debug logs
This commit is contained in:
2024-01-21 22:56:53 +02:00
parent 39e16ce408
commit d7e856aca2
4 changed files with 19 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
package web
import (
"fmt"
"net/http"
"strconv"
"time"
@@ -30,7 +29,6 @@ func setupApi(r *gin.Engine) {
var olderThan, newerThan *time.Time
if ot := ctx.Query("older"); ot != "" {
fmt.Printf("ot = %s\n", ot)
if otInt, err := strconv.ParseInt(ot, 10, 64); err == nil {
otTime := time.UnixMilli(otInt)
olderThan = &otTime
@@ -38,16 +36,12 @@ func setupApi(r *gin.Engine) {
}
if nt := ctx.Query("newer"); nt != "" {
fmt.Printf("nt = %s\n", nt)
if ntInt, err := strconv.ParseInt(nt, 10, 64); err == nil {
ntTime := time.UnixMilli(ntInt)
newerThan = &ntTime
}
}
fmt.Printf("olderThan = %s\n", olderThan)
fmt.Printf("newerThan = %s\n", newerThan)
graphData, err := svc.GetDiskGraphImage(diskId, newerThan, olderThan)
if err != nil {
ctx.AbortWithStatusJSON(500, gin.H{

View File

@@ -6,12 +6,15 @@ import (
)
func SetupRouter() *gin.Engine {
// Initialize the Gin engine
cfg := config.GetConfiguration()
r := gin.Default()
// Set gin to release
gin.SetMode(gin.ReleaseMode)
if !cfg.DebugMode {
// Set gin to release
gin.SetMode(gin.ReleaseMode)
}
// Initialize the Gin engine
r := gin.Default()
r.Use(BasicAuthMiddleware(cfg.IdentityUsername, cfg.IdentityPassword))