config.go 5.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. Oss Oss `mapstructure:"oss" json:"oss" yaml:"oss"`
  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. AppNameEn string `mapstructure:"app-name-en" json:"app-name-en" yaml:"app-name-en" description:"项目名称英文"`
  15. Md5Key string `mapstructure:"md5-key" json:"md5-key" yaml:"md5-key" description:"Md5密钥"`
  16. DesKey string `mapstructure:"des-key" json:"des-key" yaml:"des-key" description:"Des密钥"`
  17. IsStopTask bool `mapstructure:"is-stop-task" json:"is-stop-task" yaml:"is-stop-task" description:"是否停止任务,此功能用于多服务器部署时,定时任务只需一台服务器执行,其他服务器不执行的情况下设置为true"`
  18. }
  19. // Log 日志配置
  20. type Log struct {
  21. Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" description:"日志输出前缀"`
  22. LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file" description:""`
  23. Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:""`
  24. FileStdout string `mapstructure:"file-stdout" json:"file-stdout" yaml:"file-stdout" description:""`
  25. SaveMaxDay int `mapstructure:"save-max-day" json:"save-max-day" yaml:"save-max-day" description:"最多保留多少天的日志"`
  26. CuttingDay int `mapstructure:"cutting-day" json:"cutting-day" yaml:"cutting-day" description:"相隔几天切割文件"`
  27. LogDirPath string `mapstructure:"log-dir-path" json:"log-dir-path" yaml:"log-dir-path" description:"日志目录"`
  28. LogSoftLink string `mapstructure:"log-soft-link" json:"log-soft-link" yaml:"log-soft-link" description:"日志软链接"`
  29. BinlogDirPath string `mapstructure:"binlog-dir-path" json:"binlog-dir-path" yaml:"binlog-dir-path" description:"binlog日志目录"`
  30. BinlogSoftLink string `mapstructure:"binlog-soft-link" json:"binlog-soft-link" yaml:"binlog-soft-link" description:"binlog日志软链接"`
  31. FilelogDirPath string `mapstructure:"filelog-dir-path" json:"filelog-dir-path" yaml:"filelog-dir-path" description:"用户自主记录的日志目录"`
  32. FilelogSoftLink string `mapstructure:"filelog-soft-link" json:"filelog-soft-link" yaml:"filelog-soft-link" description:"用户自主记录的日志软链接"`
  33. }
  34. type Oss struct {
  35. ObjectStorageClient string `mapstructure:"object-storage-client" json:"object-storage-client" yaml:"object-storage-client" description:"oss类型,取值:oss minio,s3,默认oss"`
  36. EndPoint string `mapstructure:"end-point" json:"end-point" yaml:"end-point" description:"oss服务地址"`
  37. BackEndPoint string `mapstructure:"back-end-point" json:"back-end-point" yaml:"back-end-point" description:"oss服务地址(用于内网)"`
  38. AccessKeyId string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id" description:"oss服务access-key-id"`
  39. AccessKeySecret string `mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret" description:"oss服务access-key-secret"`
  40. BucketName string `mapstructure:"bucket-name" json:"bucket-name" yaml:"bucket-name" description:"oss服务bucketname"`
  41. RegionId string `mapstructure:"region-id" json:"region-id" yaml:"region-id" description:"oss服务region-id"`
  42. ImgHost string `mapstructure:"img-host" json:"img-host" yaml:"img-host" description:"oss服务imghost"`
  43. UploadDir string `mapstructure:"upload-dir" json:"upload-dir" yaml:"upload-dir" description:"oss服务上传路径"`
  44. Port string `mapstructure:"port" json:"port" yaml:"port" description:"oss服务端口"`
  45. ForceStyle bool `mapstructure:"force-style" json:"force-style" yaml:"force-style" description:"oss服务是否强制使用style,默认是True"`
  46. Protocol string `mapstructure:"protocol" json:"protocol" yaml:"protocol" description:"oss服务协议,默认是http"`
  47. DisableSSL bool `mapstructure:"disable-ssl" json:"disable-ssl" yaml:"disable-ssl" description:"是否禁用ssl"`
  48. OpenAcl bool `mapstructure:"open-acl" json:"open-acl" yaml:"open-acl" description:"是否开启acl"`
  49. ResourceProxyUrl string `mapstructure:"resource-proxy-url" json:"resource-proxy-url" yaml:"resource-proxy-url" description:"资源代理地址"`
  50. Ram OssRam `mapstructure:"ram" json:"ram" yaml:"ram"`
  51. }
  52. type OssRam struct {
  53. AccessKeyId string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id" description:"oss服务access-key-id"`
  54. AccessKeySecret string `mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret" description:"oss服务access-key-secret"`
  55. StsScheme string `mapstructure:"sts-scheme" json:"sts-scheme" yaml:"sts-scheme" description:"oss服务sts-scheme"`
  56. RoleArn string `mapstructure:"role-arn" json:"role-arn" yaml:"role-arn" description:"oss服务role-arn"`
  57. RoleSessionName string `mapstructure:"role-session-name" json:"role-session-name" yaml:"role-session-name" description:"oss服务role-session-name"`
  58. STSTokenCacheKey string `mapstructure:"sts-token-cache-key" json:"sts-token-cache-key" yaml:"sts-token-cache-key" description:"oss服务sts-token-cache-key(缓存key,用于获取后短期内不再重复获取)"`
  59. }