From 019134c072f263304e45dc3db092c1d7242cdb6b Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期日, 21 四月 2024 23:45:53 +0800
Subject: [PATCH] 处理设备名为空的bug

---
 config/config.go |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/config/config.go b/config/config.go
index c5b686c..97fdb61 100644
--- a/config/config.go
+++ b/config/config.go
@@ -2,6 +2,7 @@
 
 import (
 	"fmt"
+	"gat1400Exchange/pkg/logger"
 
 	"github.com/fsnotify/fsnotify"
 	"github.com/spf13/viper"
@@ -26,6 +27,8 @@
 	SyncServer     string `mapstructure:"sync-server"`
 	ReportServer   string `mapstructure:"report-server"`
 	ReportInterval int    `mapstructure:"report-interval"`
+	RetryInterval  int    `mapstructure:"retry-interval"`
+	CutFaceImage   bool   `mapstructure:"cut-face-image"`
 }
 
 type rateLimitConfig struct {
@@ -46,6 +49,7 @@
 	v.SetConfigType("yaml")
 	v.SetConfigName("gat1400")
 	v.AddConfigPath("./config/")
+	v.AddConfigPath("../config/")
 	err = v.ReadInConfig()
 	if err != nil {
 		fmt.Println("error on parsing configuration file", err)
@@ -63,4 +67,18 @@
 	v.UnmarshalKey("log", LogConf)
 	v.UnmarshalKey("forward", ForwardConf)
 	v.UnmarshalKey("rate-limit", RateLimitConf)
+
+	if LogConf.Level == "" {
+		LogConf.Level = "info"
+	}
+
+	if ForwardConf.ReportInterval == 0 {
+		ForwardConf.ReportInterval = 10
+	}
+
+	if ForwardConf.RetryInterval == 0 {
+		ForwardConf.RetryInterval = 5
+	}
+
+	logger.SetLogLevel(LogConf.Level)
 }

--
Gitblit v1.8.0