|
@@ -188,7 +188,7 @@ func InitCloudConfig() {
|
|
|
util.CreateDir(CloudConfig.BagCopyDir)
|
|
|
}
|
|
|
|
|
|
-// refreshCloudConfig 更新业务配置
|
|
|
+// 更新业务配置
|
|
|
func refreshCloudConfig() {
|
|
|
// 获取文件的目录
|
|
|
_ = util.CreateParentDir(LocalConfig.CloudConfigLocalPath)
|
|
@@ -199,6 +199,7 @@ func refreshCloudConfig() {
|
|
|
isExist, err := OssBucket.IsObjectExist(cloudConfigObjectKey)
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Errorf("判断配置文件是否存在失败,错误信息为:%v", err)
|
|
|
+ return
|
|
|
}
|
|
|
if !isExist {
|
|
|
cloudConfigObjectKey = LocalConfig.OssBasePrefix + LocalConfig.CloudConfigFilename // 默认配置文件路径
|
|
@@ -209,13 +210,12 @@ func refreshCloudConfig() {
|
|
|
OssMutex.Unlock()
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Error("下载oss上的配置文件"+cloudConfigObjectKey+"失败。", err)
|
|
|
- //os.Exit(-1)
|
|
|
}
|
|
|
|
|
|
content, err = os.ReadFile(LocalConfig.CloudConfigLocalPath)
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Error("配置文件 ", LocalConfig.CloudConfigLocalPath, " 读取失败:", err)
|
|
|
- os.Exit(-1)
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
// 4 ------- 解析YAML内容 -------
|
|
@@ -223,7 +223,7 @@ func refreshCloudConfig() {
|
|
|
err = yaml.Unmarshal(content, &newCloudConfig)
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Error("配置文件 ", LocalConfig.CloudConfigLocalPath, " 解析失败:", err)
|
|
|
- os.Exit(-1)
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
// 5 ------- 校验 yaml -------
|
|
@@ -233,11 +233,10 @@ func refreshCloudConfig() {
|
|
|
CloudConfigMutex.RUnlock()
|
|
|
} else {
|
|
|
c_log.GlobalLogger.Error("配置文件格式错误:", newCloudConfig)
|
|
|
- os.Exit(-1)
|
|
|
+ return
|
|
|
}
|
|
|
util.CreateDir(CloudConfig.BagDataDir)
|
|
|
util.CreateDir(CloudConfig.BagCopyDir)
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// RefreshCloudConfig 轮询oss上的配置文件更新到本地
|