zhangzengfei
2024-09-29 3737ab3dd0cc753be986638316c96cb3114601e4
config/config.go
@@ -15,10 +15,12 @@
}
type database struct {
   Driver string `mapstructure: "driver"`
   Host   string `mapstructure: "host"`
   Port   string `mapstructure: "port"`
   Name   string `mapstructure: "name"`
   Driver   string `mapstructure: "driver"`
   Host     string `mapstructure: "host"`
   Port     string `mapstructure: "port"`
   Name     string `mapstructure: "name"`
   Username string `mapstructure: "username"`
   Password string `mapstructure: "password"`
}
type elastic struct {
@@ -30,6 +32,7 @@
   TopHitsSize  int    `mapstructure: "topHitsSize"`
   CameraSize   int    `mapstructure: "cameraSize"`
   TimeInterval int    `mapstructure: "timeInterval"`
   BatchSize    int    `mapstructure: "batchSize"`
}
type app struct {
@@ -39,8 +42,13 @@
}
type api struct {
   Host string `mapstructure: "host"`
   Port string `mapstructure: "port"`
   Host                 string `mapstructure: "host"`
   Port                 string `mapstructure: "port"`
   CapAddrDaysThreshold int    `mapstructure:"capAddrDaysThreshold"`
   TimeThreshold        int    `mapstructure:"timeThreshold"`
   CsTimes              int    `mapstructure:"csTimes"`
   CsHours              int    `mapstructure:"csHours"`
   AInterval            int    `mapstructure:"aInterval"`
}
var LogConf = &LogConfig{}
@@ -55,7 +63,9 @@
   var err error
   viper.SetConfigType("yaml")
   viper.SetConfigName(env)
   viper.AddConfigPath("config")
   viper.AddConfigPath("./")
   viper.AddConfigPath("./config")
   viper.AddConfigPath("../config")
   err = viper.ReadInConfig()
   if err != nil {
      log.Fatal("error on parsing configuration file", err)