From a6e84625b91e19220933ed3bc8ef91435281ab26 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 16 四月 2024 16:52:35 +0800
Subject: [PATCH] 添加服务器是否可以连接的判断

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

diff --git a/config/config.go b/config/config.go
index c5b686c..0aa97b4 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,7 @@
 	SyncServer     string `mapstructure:"sync-server"`
 	ReportServer   string `mapstructure:"report-server"`
 	ReportInterval int    `mapstructure:"report-interval"`
+	RetryInterval  int    `mapstructure:"retry-interval"`
 }
 
 type rateLimitConfig struct {
@@ -63,4 +65,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