|
@@ -10,14 +10,16 @@ import (
|
|
commonHandler "cicv-data-closedloop/common/gin/handler"
|
|
commonHandler "cicv-data-closedloop/common/gin/handler"
|
|
"cicv-data-closedloop/common/util"
|
|
"cicv-data-closedloop/common/util"
|
|
_ "embed"
|
|
_ "embed"
|
|
|
|
+ "fmt"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin"
|
|
"gopkg.in/yaml.v3"
|
|
"gopkg.in/yaml.v3"
|
|
"os"
|
|
"os"
|
|
)
|
|
)
|
|
|
|
|
|
type ApplicationYamlStruct struct {
|
|
type ApplicationYamlStruct struct {
|
|
- ApplicationName string `yaml:"application"`
|
|
|
|
|
|
+ ApplicationName string `yaml:"application-name"`
|
|
Web WebStruct `yaml:"web"`
|
|
Web WebStruct `yaml:"web"`
|
|
|
|
+ Log LogStruct `yaml:"log"`
|
|
Redis RedisStruct `yaml:"redis"`
|
|
Redis RedisStruct `yaml:"redis"`
|
|
Oss OssStruct `yaml:"oss"`
|
|
Oss OssStruct `yaml:"oss"`
|
|
GpuNodeList []GpuNode `yaml:"gpu_node_list"`
|
|
GpuNodeList []GpuNode `yaml:"gpu_node_list"`
|
|
@@ -30,17 +32,22 @@ type WebStruct struct {
|
|
WhiteList []string `yaml:"white-list"`
|
|
WhiteList []string `yaml:"white-list"`
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+type LogStruct struct {
|
|
|
|
+ Dir string `yaml:"dir"`
|
|
|
|
+ Prefix string `yaml:"prefix"`
|
|
|
|
+}
|
|
|
|
+
|
|
type RedisStruct struct {
|
|
type RedisStruct struct {
|
|
Addr string `yaml:"addr"`
|
|
Addr string `yaml:"addr"`
|
|
Password string `yaml:"password"`
|
|
Password string `yaml:"password"`
|
|
Db int `yaml:"db"`
|
|
Db int `yaml:"db"`
|
|
}
|
|
}
|
|
type OssStruct struct {
|
|
type OssStruct struct {
|
|
- IsUseCname bool `json:"is-use-cname"`
|
|
|
|
- Endpoint string `json:"endpoint"`
|
|
|
|
- AccessKeyId string `json:"accessKeyId"`
|
|
|
|
- AccessKeySecret string `json:"accessKeySecret"`
|
|
|
|
- BucketName string `json:"bucketName"`
|
|
|
|
|
|
+ IsUseCname bool `yaml:"is-use-cname"`
|
|
|
|
+ Endpoint string `yaml:"endpoint"`
|
|
|
|
+ AccessKeyId string `yaml:"access-key-id"`
|
|
|
|
+ AccessKeySecret string `yaml:"access-key-secret"`
|
|
|
|
+ BucketName string `yaml:"bucket-name"`
|
|
}
|
|
}
|
|
|
|
|
|
type GpuNode struct {
|
|
type GpuNode struct {
|
|
@@ -58,8 +65,9 @@ var (
|
|
func init() {
|
|
func init() {
|
|
// 1 解析YAML内容
|
|
// 1 解析YAML内容
|
|
_ = yaml.Unmarshal(applicationYamlBytes, &ApplicationYaml)
|
|
_ = yaml.Unmarshal(applicationYamlBytes, &ApplicationYaml)
|
|
|
|
+ fmt.Println("加载配置文件内容为:", ApplicationYaml)
|
|
// 2 初始化 日志
|
|
// 2 初始化 日志
|
|
- infra.InitLog("./log/", ApplicationYaml.ApplicationName)
|
|
|
|
|
|
+ infra.InitLog(ApplicationYaml.Log.Dir, ApplicationYaml.Log.Prefix)
|
|
// 3 初始化 阿里云oss 客户端
|
|
// 3 初始化 阿里云oss 客户端
|
|
infra.InitOss(
|
|
infra.InitOss(
|
|
ApplicationYaml.Oss.IsUseCname,
|
|
ApplicationYaml.Oss.IsUseCname,
|