config.go 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
  6. Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
  7. OracleJY OracleJY `mapstructure:"oracle_jy" json:"oracle_jy" yaml:"oracle_jy"`
  8. }
  9. // Serve gin服务配置
  10. type Serve struct {
  11. Port int `mapstructure:"port" json:"port" yaml:"port" description:"gin开启监听http服务的端口"`
  12. RunMode string `mapstructure:"run-mode" json:"run-mode" yaml:"run-mode" description:"gin运行模式的默认,枚举值:debug,release"`
  13. UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis" description:"是否使用redis"`
  14. AppName string `mapstructure:"app-name" json:"app-name" yaml:"app-name" description:"项目名称"`
  15. StaticDir string `mapstructure:"static-dir" json:"static-dir" yaml:"static-dir" description:"上传的文件存储目录地址"`
  16. AppNameEn string `mapstructure:"app-name-en" json:"app-name-en" yaml:"app-name-en" description:"项目名称英文"`
  17. Md5Key string `mapstructure:"md5-key" json:"md5-key" yaml:"md5-key" description:"Md5密钥"`
  18. DesKey string `mapstructure:"des-key" json:"des-key" yaml:"des-key" description:"Des密钥"`
  19. }
  20. // Log 日志配置
  21. type Log struct {
  22. Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" description:"日志输出前缀"`
  23. LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file" description:""`
  24. Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:""`
  25. FileStdout string `mapstructure:"file-stdout" json:"file-stdout" yaml:"file-stdout" description:""`
  26. SaveMaxDay int `mapstructure:"save-max-day" json:"save-max-day" yaml:"save-max-day" description:"最多保留多少天的日志"`
  27. CuttingDay int `mapstructure:"cutting-day" json:"cutting-day" yaml:"cutting-day" description:"相隔几天切割文件"`
  28. LogDirPath string `mapstructure:"log-dir-path" json:"log-dir-path" yaml:"log-dir-path" description:"日志目录"`
  29. LogSoftLink string `mapstructure:"log-soft-link" json:"log-soft-link" yaml:"log-soft-link" description:"日志软链接"`
  30. BinlogDirPath string `mapstructure:"binlog-dir-path" json:"binlog-dir-path" yaml:"binlog-dir-path" description:"binlog日志目录"`
  31. BinlogSoftLink string `mapstructure:"binlog-soft-link" json:"binlog-soft-link" yaml:"binlog-soft-link" description:"binlog日志软链接"`
  32. }
  33. // Mysql 数据库配置
  34. type Mysql struct {
  35. //LogMode bool `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode" description:"是否开启日志"`
  36. Stdout bool `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:"日志是否输出在控制台"`
  37. DefaultDsnAliasName string `mapstructure:"default-dsn-alias-name" json:"default-dsn-alias-name" yaml:"default-dsn-alias-name" description:"默认的数据库连接别名"`
  38. List []MysqlConn `mapstructure:"list" json:"list" yaml:"list" description:"数据库链接配置列表"`
  39. }
  40. // MysqlConn mysql数据链接配置
  41. type MysqlConn struct {
  42. Dsn string `mapstructure:"dsn" json:"dsc" yaml:"dsn" description:"数据库连接配置"`
  43. AliasName string `mapstructure:"alias-name" json:"alias-name" yaml:"alias-name" description:"数据库别名"`
  44. MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns" description:"最大空闲连接"`
  45. MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns" description:"最大连接数"`
  46. }
  47. // Redis redis配置
  48. type Redis struct {
  49. Address string `mapstructure:"address" json:"address" yaml:"address" description:"redis服务链接地址"`
  50. Password string `mapstructure:"password" json:"password" yaml:"password" description:"redis服务密码"`
  51. Db int `mapstructure:"db" json:"db" yaml:"db" description:"默认使用的redis库"`
  52. }
  53. // OracleJY 嘉悦物产数据库配置
  54. type OracleJY struct {
  55. Conn string `mapstructure:"conn" json:"conn" yaml:"conn" description:"服务链接地址"`
  56. Account string `mapstructure:"account" json:"account" yaml:"account" description:"oracle数据库账号"`
  57. Password string `mapstructure:"password" json:"password" yaml:"password" description:"oracle数据库密码"`
  58. LibDir string `mapstructure:"lib_dir" json:"lib_dir" yaml:"lib_dir" description:"oracle数据库组件"`
  59. }