config.go 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. IndexSaveDir string `mapstructure:"index-save-dir" json:"index-save-dir" yaml:"index-save-dir" description:"监听文件夹的路径"`
  15. IndexMergeSaveDir string `mapstructure:"index-merge-save-dir" json:"index-merge-save-dir" yaml:"index-merge-save-dir" description:"监听合并文件夹的路径"`
  16. Frequency string `mapstructure:"frequency" json:"frequency" yaml:"frequency" description:"频度"`
  17. SystemType string `mapstructure:"frequency" json:"frequency" yaml:"frequency" description:"类型定义"`
  18. EdbLibUrl string `mapstructure:"edb-lib-url" json:"edb-lib-url" yaml:"edb-lib-url" description:"公共指标库的地址"`
  19. AppEdbLibNameEn string `mapstructure:"app_edb_lib_name_en" json:"app_edb_lib_name_en" yaml:"app_edb_lib_name_en" description:"指标库的英文名称"`
  20. EdbLibMd5Key string `mapstructure:"edb_lib_md5_key" json:"edb_lib_md5_key" yaml:"edb_lib_md5_key" description:"指标库服务秘钥"`
  21. }
  22. // Log 日志配置
  23. type Log struct {
  24. Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" description:"日志输出前缀"`
  25. LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file" description:""`
  26. Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:""`
  27. FileStdout string `mapstructure:"file-stdout" json:"file-stdout" yaml:"file-stdout" description:""`
  28. SaveMaxDay int `mapstructure:"save-max-day" json:"save-max-day" yaml:"save-max-day" description:"最多保留多少天的日志"`
  29. CuttingDay int `mapstructure:"cutting-day" json:"cutting-day" yaml:"cutting-day" description:"相隔几天切割文件"`
  30. LogDirPath string `mapstructure:"log-dir-path" json:"log-dir-path" yaml:"log-dir-path" description:"日志目录"`
  31. LogSoftLink string `mapstructure:"log-soft-link" json:"log-soft-link" yaml:"log-soft-link" description:"日志软链接"`
  32. BinlogDirPath string `mapstructure:"binlog-dir-path" json:"binlog-dir-path" yaml:"binlog-dir-path" description:"binlog日志目录"`
  33. BinlogSoftLink string `mapstructure:"binlog-soft-link" json:"binlog-soft-link" yaml:"binlog-soft-link" description:"binlog日志软链接"`
  34. }
  35. // Redis redis配置
  36. type Redis struct {
  37. Address string `mapstructure:"address" json:"address" yaml:"address" description:"redis服务链接地址"`
  38. Password string `mapstructure:"password" json:"password" yaml:"password" description:"redis服务密码"`
  39. Db int `mapstructure:"db" json:"db" yaml:"db" description:"默认使用的redis库"`
  40. }