config.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. Business Business `mapstructure:"business" json:"business" yaml:"business"`
  9. Smm Smm `mapstructure:"smm" json:"smm" yaml:"smm"`
  10. Xiangyu Xiangyu `mapstructure:"xiangyu" json:"xiangyu" yaml:"xiangyu"`
  11. PCSG PCSG `mapstructure:"pcsg" json:"pcsg" yaml:"pcsg"`
  12. HTFutures HTFutures `mapstructure:"htFutures" json:"htFutures" yaml:"htFutures"`
  13. }
  14. // Serve gin服务配置
  15. type Serve struct {
  16. Port int `mapstructure:"port" json:"port" yaml:"port" description:"gin开启监听http服务的端口"`
  17. RunMode string `mapstructure:"run-mode" json:"run-mode" yaml:"run-mode" description:"gin运行模式的默认,枚举值:debug,release"`
  18. UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis" description:"是否使用redis"`
  19. AppName string `mapstructure:"app-name" json:"app-name" yaml:"app-name" description:"项目名称"`
  20. StaticDir string `mapstructure:"static-dir" json:"static-dir" yaml:"static-dir" description:"上传的文件存储目录地址"`
  21. AppNameEn string `mapstructure:"app-name-en" json:"app-name-en" yaml:"app-name-en" description:"项目名称英文"`
  22. Md5Key string `mapstructure:"md5-key" json:"md5-key" yaml:"md5-key" description:"Md5密钥"`
  23. DesKey string `mapstructure:"des-key" json:"des-key" yaml:"des-key" description:"Des密钥"`
  24. IsStopTask bool `mapstructure:"is-stop-task" json:"is-stop-task" yaml:"is-stop-task" description:"是否停止任务,此功能用于多服务器部署时,定时任务只需一台服务器执行,其他服务器不执行的情况下设置为true"`
  25. }
  26. // Log 日志配置
  27. type Log struct {
  28. Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" description:"日志输出前缀"`
  29. LogFile bool `mapstructure:"log-file" json:"logFile" yaml:"log-file" description:""`
  30. Stdout string `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:""`
  31. FileStdout string `mapstructure:"file-stdout" json:"file-stdout" yaml:"file-stdout" description:""`
  32. SaveMaxDay int `mapstructure:"save-max-day" json:"save-max-day" yaml:"save-max-day" description:"最多保留多少天的日志"`
  33. CuttingDay int `mapstructure:"cutting-day" json:"cutting-day" yaml:"cutting-day" description:"相隔几天切割文件"`
  34. LogDirPath string `mapstructure:"log-dir-path" json:"log-dir-path" yaml:"log-dir-path" description:"日志目录"`
  35. LogSoftLink string `mapstructure:"log-soft-link" json:"log-soft-link" yaml:"log-soft-link" description:"日志软链接"`
  36. BinlogDirPath string `mapstructure:"binlog-dir-path" json:"binlog-dir-path" yaml:"binlog-dir-path" description:"binlog日志目录"`
  37. BinlogSoftLink string `mapstructure:"binlog-soft-link" json:"binlog-soft-link" yaml:"binlog-soft-link" description:"binlog日志软链接"`
  38. FilelogDirPath string `mapstructure:"filelog-dir-path" json:"filelog-dir-path" yaml:"filelog-dir-path" description:"用户自主记录的日志目录"`
  39. FilelogSoftLink string `mapstructure:"filelog-soft-link" json:"filelog-soft-link" yaml:"filelog-soft-link" description:"用户自主记录的日志软链接"`
  40. }
  41. // Mysql 数据库配置
  42. type Mysql struct {
  43. //LogMode bool `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode" description:"是否开启日志"`
  44. Stdout bool `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:"日志是否输出在控制台"`
  45. DefaultDsnAliasName string `mapstructure:"default-dsn-alias-name" json:"default-dsn-alias-name" yaml:"default-dsn-alias-name" description:"默认的数据库连接别名"`
  46. List []MysqlConn `mapstructure:"list" json:"list" yaml:"list" description:"数据库链接配置列表"`
  47. Binlog Binlog `mapstructure:"binlog" json:"binlog" yaml:"binlog" description:"mysql binlog配置"`
  48. }
  49. type Binlog struct {
  50. IsListen bool `mapstructure:"is-listen" json:"is-listen" yaml:"is-listen" description:"是否监听mysql binlog"`
  51. ServerID uint32 `mapstructure:"server-id" json:"server-id" yaml:"server-id" description:"mysql binlog server id" default:"10000"`
  52. LogSaveDay int `mapstructure:"log-save-day" json:"log-save-day" yaml:"log-save-day" description:"更新日志保存天数" default:"10"`
  53. Host string `mapstructure:"host" json:"host" yaml:"host" description:"mysql binlog地址"`
  54. User string `mapstructure:"user" json:"user" yaml:"user" description:"mysql binlog用户名"`
  55. Password string `mapstructure:"password" json:"password" yaml:"password" description:"mysql binlog密码"`
  56. Db string `mapstructure:"db" json:"db" yaml:"db" description:"mysql binlog数据库"`
  57. }
  58. // MysqlConn mysql数据链接配置
  59. type MysqlConn struct {
  60. Dsn string `mapstructure:"dsn" json:"dsc" yaml:"dsn" description:"数据库连接配置"`
  61. AliasName string `mapstructure:"alias-name" json:"alias-name" yaml:"alias-name" description:"数据库别名"`
  62. MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns" description:"最大空闲连接"`
  63. MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns" description:"最大连接数"`
  64. }
  65. // Redis redis配置
  66. type Redis struct {
  67. Address string `mapstructure:"address" json:"address" yaml:"address" description:"redis服务链接地址"`
  68. Password string `mapstructure:"password" json:"password" yaml:"password" description:"redis服务密码"`
  69. Db int `mapstructure:"db" json:"db" yaml:"db" description:"默认使用的redis库"`
  70. ServeType string `mapstructure:"serve-type" json:"serve-type" yaml:"serve-type" description:"redis服务类型,单机或者cluster;默认单机"`
  71. }
  72. // OracleJY 嘉悦物产数据库配置
  73. type OracleJY struct {
  74. Conn string `mapstructure:"conn" json:"conn" yaml:"conn" description:"服务链接地址"`
  75. Account string `mapstructure:"account" json:"account" yaml:"account" description:"oracle数据库账号"`
  76. Password string `mapstructure:"password" json:"password" yaml:"password" description:"oracle数据库密码"`
  77. LibDir string `mapstructure:"lib_dir" json:"lib_dir" yaml:"lib_dir" description:"oracle数据库组件"`
  78. }
  79. // Business 商家的配置
  80. type Business struct {
  81. JiaYueIndexSyncMinute int `mapstructure:"jiayue-index-sync-minute" json:"jiayue-index-sync-minute" yaml:"jiayue-index-sync-minute" description:"嘉悦同步N分钟前至现在的指标(负数)"`
  82. }
  83. // Smm smm配置
  84. type Smm struct {
  85. Username string `mapstructure:"username" json:"username" yaml:"username" description:"smm账号"`
  86. Password string `mapstructure:"password" json:"password" yaml:"password" description:"smm密码"`
  87. }
  88. // Xiangyu 象屿的配置
  89. type Xiangyu struct {
  90. SystemCode string `mapstructure:"system-code" json:"system-code" yaml:"system-code" description:"系统编码"`
  91. UserSyncTarget string `mapstructure:"user-sync-target" json:"user-sync-target" yaml:"user-sync-target" description:"用户同步平台编码"`
  92. UserSyncHost string `mapstructure:"user-sync-host" json:"user-sync-host" yaml:"user-sync-host" description:"用户同步平台地址"`
  93. UserAuthHost string `mapstructure:"user-auth-host" json:"user-auth-host" yaml:"user-auth-host" description:"用户认证平台地址"`
  94. UserSyncAuthUserName string `mapstructure:"user-sync-auth-user-name" json:"user-sync-auth-user-name" yaml:"user-sync-auth-user-name" description:"用户统一身份的鉴权username"`
  95. UserSyncAuthPwd string `mapstructure:"user-sync-auth-pwd" json:"user-sync-auth-pwd" yaml:"user-sync-auth-pwd" description:"用户统一身份的鉴权password"`
  96. UserKey string `mapstructure:"user-key" json:"user-key" yaml:"user-key" description:"统一平台秘钥"`
  97. DefaultRoleId int `mapstructure:"default-role-id" json:"default-role-id" yaml:"default-role-id" description:"默认的角色id"`
  98. IndexSyncHost string `mapstructure:"index-sync-host" json:"index-sync-host" yaml:"index-sync-host" description:"指标同步平台地址"`
  99. IndexSyncAuthUserName string `mapstructure:"index-sync-auth-user-name" json:"index-sync-auth-user-name" yaml:"index-sync-auth-user-name" description:"用户统一身份的鉴权username"`
  100. IndexSyncAuthPwd string `mapstructure:"index-sync-auth-pwd" json:"index-sync-auth-pwd" yaml:"index-sync-auth-pwd" description:"用户统一身份的鉴权password"`
  101. IndexKey string `mapstructure:"index-key" json:"index-key" yaml:"index-key" description:"统一平台秘钥"`
  102. IndexSyncTarget string `mapstructure:"index-sync-target" json:"index-sync-target" yaml:"index-sync-target" description:"指标同步平台编码"`
  103. IndexCrmHost string `mapstructure:"index-crm-host" json:"index-crm-host" yaml:"index-crm-host" description:"crm指标平台地址"`
  104. IndexCrmTarget string `mapstructure:"index-crm-target" json:"index-crm-target" yaml:"index-crm-target" description:"crm指标平台编码"`
  105. }
  106. // 海通的配置
  107. type HTFutures struct {
  108. APIAuth bool `mapstructure:"api-auth" json:"api-auth" yaml:"api-auth" description:"海通SSO登录签名认证"`
  109. PrivateKeyPemPath string `mapstructure:"private-key-pem-path" json:"private-key-pem-path" yaml:"private-key-pem-path" description:"私钥文件目录"`
  110. SSOAuthHost string `mapstructure:"sso-auth-host" json:"sso-auth-host" yaml:"sso-auth-host" description:"用户认证平台地址"`
  111. OaDBDns string `mapstructure:"oa-db-dns" json:"oa-db-dns" yaml:"oa-db-dns" description:"OA数据库连接地址"`
  112. OaDBDnsOrm string `mapstructure:"oa-db-dns-orm" json:"oa-db-dns-orm" yaml:"oa-db-dns-orm" description:"OA数据库连接地址-orm"`
  113. SyncTask SyncTask `mapstructure:"sync-task" json:"sync-task" yaml:"sync-task" description:"同步任务"`
  114. //UserKey string `mapstructure:"user-key" json:"user-key" yaml:"user-key" description:"统一平台秘钥"`
  115. //DefaultRoleId int `mapstructure:"default-role-id" json:"default-role-id" yaml:"default-role-id" description:"默认的角色id"`
  116. //IndexSyncHost string `mapstructure:"index-sync-host" json:"index-sync-host" yaml:"index-sync-host" description:"指标同步平台地址"`
  117. //IndexSyncAuthUserName string `mapstructure:"index-sync-auth-user-name" json:"index-sync-auth-user-name" yaml:"index-sync-auth-user-name" description:"用户统一身份的鉴权username"`
  118. //IndexSyncAuthPwd string `mapstructure:"index-sync-auth-pwd" json:"index-sync-auth-pwd" yaml:"index-sync-auth-pwd" description:"用户统一身份的鉴权password"`
  119. //IndexKey string `mapstructure:"index-key" json:"index-key" yaml:"index-key" description:"统一平台秘钥"`
  120. //IndexSyncTarget string `mapstructure:"index-sync-target" json:"index-sync-target" yaml:"index-sync-target" description:"指标同步平台编码"`
  121. //IndexCrmHost string `mapstructure:"index-crm-host" json:"index-crm-host" yaml:"index-crm-host" description:"crm指标平台地址"`
  122. //IndexCrmTarget string `mapstructure:"index-crm-target" json:"index-crm-target" yaml:"index-crm-target" description:"crm指标平台编码"`
  123. }
  124. type SyncTask struct {
  125. EnableTask bool `mapstructure:"enable-task" json:"enable-task" yaml:"enable-task" description:"是否启动同步任务"`
  126. SyncTaskInterval int `mapstructure:"sync-task-interval" json:"sync-task-interval" yaml:"sync-task-interval" description:"定时任务时间间隔"`
  127. SyncRoleId int `mapstructure:"sync_role_id" json:"sync_role_id" yaml:"sync_role_id" description:"同步用户角色id"`
  128. }
  129. type PCSG struct {
  130. BloombergApiUrl string `mapstructure:"bloomberge-api-url" json:"bloomberge-api-url" yaml:"bloomberge-api-url" description:"彭博API服务地址"`
  131. }