-
Notifications
You must be signed in to change notification settings - Fork 66
/
model.go
109 lines (95 loc) · 5.06 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package config
import (
"fmt"
myZap "github.com/aaronchen2k/deeptest/pkg/core/zap"
)
type Config struct {
MaxSize int64 `mapstructure:"max-size" json:"burst" yaml:"max-size"`
System System `mapstructure:"system" json:"system" yaml:"system"`
Limit Limit `mapstructure:"limit" json:"limit" yaml:"limit"`
Zap myZap.Zap `mapstructure:"zap" json:"zap" yaml:"zap"`
Redis Redis `mapstructure:"redis" json:"redis" yaml:"redis"`
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
Ldap bool `mapstructure:"ldap" json:"ldap" yaml:"ldap"`
ThirdParty ThirdParty `mapstructure:"third-party" json:"third-party" yaml:"third-party"`
Mcs Mcs `mapstructure:"mcs" json:"mcs" yaml:"mcs"`
Environment Environment `mapstructure:"environment" json:"environment" yaml:"environment"`
OpenApi OpenApi `mapstructure:"openapi" json:"openapi" yaml:"openapi"`
Saas Saas `mapstructure:"saas" json:"saas" yaml:"saas"`
}
type System struct {
Name string `mapstructure:"name" json:"name" yaml:"name"`
SysEnv string `mapstructure:"sysEnv" json:"sysEnv" yaml:"sysEnv"` // dev, leyan_test, deeptest_demo etc.
Level string `mapstructure:"level" json:"level" yaml:"level"` // debug,release,test
ServerAddress string `mapstructure:"serverAddress" json:"serverAddress" yaml:"serverAddress"`
AgentAddress string `mapstructure:"agentAddress" json:"agentAddress" yaml:"agentAddress"`
StaticPath string `mapstructure:"static-path" json:"staticPath" yaml:"static-path"`
WebPath string `mapstructure:"web-path" json:"webPath" yaml:"web-path"`
DbType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"`
CacheType string `mapstructure:"cache-type" json:"cacheType" yaml:"cache-type"`
TimeFormat string `mapstructure:"time-format" json:"timeFormat" yaml:"time-format"`
}
type Limit struct {
Disable bool `mapstructure:"disable" json:"disable" yaml:"disable"`
Limit float64 `mapstructure:"limit" json:"limit" yaml:"limit"`
Burst int `mapstructure:"burst" json:"burst" yaml:"burst"`
}
type Redis struct {
DB int `mapstructure:"db" json:"db" yaml:"db"`
Addr string `mapstructure:"addr" json:"addr" yaml:"addr"`
Password string `mapstructure:"password" json:"password" yaml:"password"`
PoolSize int `mapstructure:"pool-size" json:"poolSize" yaml:"pool-size"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"`
}
type Mysql struct {
Url string `mapstructure:"url" json:"url" yaml:"url"`
Config string `mapstructure:"config" json:"config" yaml:"config"`
Dbname string `mapstructure:"db-name" json:"dbname" yaml:"db-name"`
Username string `mapstructure:"username" json:"username" yaml:"username"`
Password string `mapstructure:"password" json:"password" yaml:"password"`
MaxIdleConns int `mapstructure:"max-idle-conns" json:"maxIdleConns" yaml:"max-idle-conns"`
MaxOpenConns int `mapstructure:"max-open-conns" json:"maxOpenConns" yaml:"max-open-conns"`
LogMode bool `mapstructure:"log-mode" json:"logMode" yaml:"log-mode"`
LogZap string `mapstructure:"log-zap" json:"logZap" yaml:"log-zap"` //silent,error,warn,info,zap
}
func (m *Mysql) Dsn() string {
return fmt.Sprintf("%s:%s@tcp(%s)/%s?%s", m.Username, m.Password, m.Url, m.Dbname, m.Config)
}
type Captcha struct {
KeyLong int `mapstructure:"key-long" json:"keyLong" yaml:"key-long"`
ImgWidth int `mapstructure:"img-width" json:"imgWidth" yaml:"img-width"`
ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"`
}
type ThirdParty struct {
Username string `mapstructure:"username" json:"username" yaml:"username"`
Password string `mapstructure:"password" json:"password" yaml:"password"`
Url string `mapstructure:"url" json:"url" yaml:"url"`
ApiSign ApiSign `mapstructure:"apiSign" json:"apiSign" yaml:"apiSign"`
Host string `mapstructure:"host" json:"host" yaml:"host"`
Lcurl string `mapstructure:"lcurl" json:"lcurl" yaml:"lcurl"`
}
type ApiSign struct {
AppKey string `mapstructure:"appKey" json:"appKey" yaml:"appKey"`
AppSecret string `mapstructure:"appSecret" json:"appSecret" yaml:"appSecret"`
}
type Mcs struct {
Url string `json:"url"`
McsAppid string `json:"mcsAppid"`
ImAppid int `json:"imAppid"`
Switch bool `json:"switch"`
}
type Environment struct {
ServerHost string `mapstructure:"server-host" json:"serverHost" yaml:"server-host"`
}
type OpenApi struct {
AppSecret string `mapstructure:"appsecret" json:"appsecret" yaml:"appsecret"`
}
type Saas struct {
Switch bool `mapstructure:"switch" json:"switch" yaml:"switch"`
Username string `mapstructure:"username" json:"username" yaml:"username"`
Password string `mapstructure:"password" json:"password" yaml:"password"`
Url string `mapstructure:"url" json:"url" yaml:"url"`
ApiSign ApiSign `mapstructure:"apiSign" json:"apiSign" yaml:"apiSign"`
Host string `mapstructure:"host" json:"host" yaml:"host"`
}