config.go 7.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. Gn Gn `mapstructure:"gn" json:"gn" yaml:"gn"`
  8. }
  9. type Serve struct {
  10. Port int `mapstructure:"port" json:"port" yaml:"port" description:"gin开启监听http服务的端口"`
  11. RunMode string `mapstructure:"run-mode" json:"run-mode" yaml:"run-mode" description:"gin运行模式的默认,枚举值:debug,release"`
  12. UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis" description:"是否使用redis"`
  13. AppName string `mapstructure:"app-name" json:"app-name" yaml:"app-name" description:"项目名称"`
  14. StaticDir string `mapstructure:"static-dir" json:"static-dir" yaml:"static-dir" description:"上传的文件存储目录地址"`
  15. AppNameEn string `mapstructure:"app-name-en" json:"app-name-en" yaml:"app-name-en" description:"项目名称英文"`
  16. Md5Key string `mapstructure:"md5-key" json:"md5-key" yaml:"md5-key" description:"Md5密钥"`
  17. DesKey string `mapstructure:"des-key" json:"des-key" yaml:"des-key" description:"Des密钥"`
  18. IsStopTask bool `mapstructure:"is-stop-task" json:"is-stop-task" yaml:"is-stop-task" description:"是否停止任务,此功能用于多服务器部署时,定时任务只需一台服务器执行,其他服务器不执行的情况下设置为true"`
  19. }
  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 Mysql struct {
  35. Stdout bool `mapstructure:"stdout" json:"stdout" yaml:"stdout" description:"日志是否输出在控制台"`
  36. DefaultDsnAliasName string `mapstructure:"default-dsn-alias-name" json:"default-dsn-alias-name" yaml:"default-dsn-alias-name" description:"默认的数据库连接别名"`
  37. List []MysqlConn `mapstructure:"list" json:"list" yaml:"list" description:"数据库链接配置列表"`
  38. Binlog Binlog `mapstructure:"binlog" json:"binlog" yaml:"binlog" description:"mysql binlog配置"`
  39. }
  40. type Binlog struct {
  41. IsListen bool `mapstructure:"is-listen" json:"is-listen" yaml:"is-listen" description:"是否监听mysql binlog"`
  42. ServerID uint32 `mapstructure:"server-id" json:"server-id" yaml:"server-id" description:"mysql binlog server id" default:"10000"`
  43. LogSaveDay int `mapstructure:"log-save-day" json:"log-save-day" yaml:"log-save-day" description:"更新日志保存天数" default:"10"`
  44. Host string `mapstructure:"host" json:"host" yaml:"host" description:"mysql binlog地址"`
  45. User string `mapstructure:"user" json:"user" yaml:"user" description:"mysql binlog用户名"`
  46. Password string `mapstructure:"password" json:"password" yaml:"password" description:"mysql binlog密码"`
  47. Db string `mapstructure:"db" json:"db" yaml:"db" description:"mysql binlog数据库"`
  48. }
  49. type MysqlConn struct {
  50. Dsn string `mapstructure:"dsn" json:"dsc" yaml:"dsn" description:"数据库连接配置"`
  51. AliasName string `mapstructure:"alias-name" json:"alias-name" yaml:"alias-name" description:"数据库别名"`
  52. MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns" description:"最大空闲连接"`
  53. MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns" description:"最大连接数"`
  54. }
  55. type Redis struct {
  56. Address string `mapstructure:"address" json:"address" yaml:"address" description:"redis服务链接地址"`
  57. Password string `mapstructure:"password" json:"password" yaml:"password" description:"redis服务密码"`
  58. Db int `mapstructure:"db" json:"db" yaml:"db" description:"默认使用的redis库"`
  59. ServeType string `mapstructure:"serve-type" json:"serve-type" yaml:"serve-type" description:"redis服务类型,单机或者cluster;默认单机"`
  60. }
  61. type Gn struct {
  62. IndexSyncMinute int `mapstructure:"index-sync-minute" json:"index-sync-minute" yaml:"index-sync-minute" description:"国能同步N分钟前至现在的指标(负数)"`
  63. DataHost string `mapstructure:"data-host" json:"data-host" yaml:"data-host" description:"数据节点地址"`
  64. DataAccessTokenUrl string `mapstructure:"data-access-token-url" json:"data-access-token-url" yaml:"data-access-token-url" description:"获取数据节点的access_token地址"`
  65. DataEdbListUrl string `mapstructure:"data-edb-list-url" json:"data-edb-list-url" yaml:"data-edb-list-url" description:"获取数据节点的指标列表地址"`
  66. DataEdbValueListUrl string `mapstructure:"data-edb-value-list-url" json:"data-edb-value-list-url" yaml:"data-edb-value-list-url" description:"获取数据节点的指标明细数据地址"`
  67. DataAccessKey string `mapstructure:"data-access-key" json:"data-access-key" yaml:"data-access-key" description:"数据节点的access_key"`
  68. DataAccessSecret string `mapstructure:"data-access-secret" json:"data-access-secret" yaml:"data-access-secret" description:"数据节点的access_secret"`
  69. AuthClientId string `mapstructure:"auth-client-id" json:"auth-client-id" yaml:"auth-client-id" description:"统一认证-ClientID"`
  70. AuthClientSecret string `mapstructure:"auth-client-secret" json:"auth-client-secret" yaml:"auth-client-secret" description:"统一认证-密钥"`
  71. AuthSSOCallbackUrl string `mapstructure:"auth-sso-callback-url" json:"auth-sso-callback-url" yaml:"auth-sso-callback-url" description:"统一认证-回调地址"`
  72. AuthTokenApiUrl string `mapstructure:"auth-token-api-url" json:"auth-token-api-url" yaml:"auth-token-api-url" description:"统一认证-获取Token地址"`
  73. AuthUserApiUrl string `mapstructure:"auth-user-api-url" json:"auth-user-api-url" yaml:"auth-user-api-url" description:"统一认证-获取UserInfo地址"`
  74. DefaultRoleId int `mapstructure:"default-role-id" json:"default-role-id" yaml:"default-role-id" description:"默认的角色id"`
  75. DefaultUserPass string `mapstructure:"default-user-pass" json:"default-user-pass" yaml:"default-user-pass" description:"默认密码"`
  76. OAHost string `mapstructure:"oa-host" json:"oa-host" yaml:"oa-host" description:"oa服务地址"`
  77. }