config.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package config
  2. type Config struct {
  3. Log Log `mapstructure:"log" json:"log" yaml:"log"`
  4. Serve Serve `mapstructure:"serve" json:"serve" yaml:"serve"`
  5. Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
  6. }
  7. // Serve gin服务配置
  8. type Serve struct {
  9. Port int `mapstructure:"port" json:"port" yaml:"port" description:"gin开启监听http服务的端口"`
  10. RunMode string `mapstructure:"run-mode" json:"run-mode" yaml:"run-mode" description:"gin运行模式的默认,枚举值:debug,release"`
  11. UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis" description:"是否使用redis"`
  12. AppName string `mapstructure:"app-name" json:"app-name" yaml:"app-name" description:"项目名称"`
  13. StaticDir string `mapstructure:"static-dir" json:"static-dir" yaml:"static-dir" description:"上传的文件存储目录地址"`
  14. EdbLibUrl string `mapstructure:"edb-lib-url" json:"edb-lib-url" yaml:"edb-lib-url" description:"公共指标库的地址"`
  15. IndexSaveDir string `mapstructure:"index-save-dir" json:"index-save-dir" yaml:"index-save-dir" description:"监听文件夹的路径"`
  16. IndexMergeSaveDir string `mapstructure:"index-merge-save-dir" json:"index-merge-save-dir" yaml:"index-merge-save-dir" description:"监听合并文件夹的路径"`
  17. }
  18. // Log 日志配置
  19. type Log struct {
  20. Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" description:"日志输出前缀"`
  21. LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file" description:""`
  22. Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:""`
  23. FileStdout string `mapstructure:"file-stdout" json:"file-stdout" yaml:"file-stdout" description:""`
  24. SaveMaxDay int `mapstructure:"save-max-day" json:"save-max-day" yaml:"save-max-day" description:"最多保留多少天的日志"`
  25. CuttingDay int `mapstructure:"cutting-day" json:"cutting-day" yaml:"cutting-day" description:"相隔几天切割文件"`
  26. LogDirPath string `mapstructure:"log-dir-path" json:"log-dir-path" yaml:"log-dir-path" description:"日志目录"`
  27. LogSoftLink string `mapstructure:"log-soft-link" json:"log-soft-link" yaml:"log-soft-link" description:"日志软链接"`
  28. BinlogDirPath string `mapstructure:"binlog-dir-path" json:"binlog-dir-path" yaml:"binlog-dir-path" description:"binlog日志目录"`
  29. BinlogSoftLink string `mapstructure:"binlog-soft-link" json:"binlog-soft-link" yaml:"binlog-soft-link" description:"binlog日志软链接"`
  30. }
  31. // Redis redis配置
  32. type Redis struct {
  33. Address string `mapstructure:"address" json:"address" yaml:"address" description:"redis服务链接地址"`
  34. Password string `mapstructure:"password" json:"password" yaml:"password" description:"redis服务密码"`
  35. Db int `mapstructure:"db" json:"db" yaml:"db" description:"默认使用的redis库"`
  36. }