/
schema.go
57 lines (48 loc) · 977 Bytes
/
schema.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
/*
* @Author: fzf404
* @Date: 2022-08-18 11:01:34
* @LastEditors: fzf404 nmdfzf404@163.com
* @LastEditTime: 2022-08-25 19:08:21
* @Description: 配置模型
*/
package config
type Config struct {
Mode Mode
Http Http
Redis Redis
Postgres Postgres
Limit Limit
Cors Cors
}
type Mode struct {
RunMode string
}
type Http struct {
Url string
Host string
Port string
}
type Redis struct {
Addr string
Password string
}
type Postgres struct {
Host string
Port string
User string
Password string
DBName string
}
func (r Postgres) Dsn() string {
return "host=" + r.Host + " user=" + r.User + " password=" + r.Password + " dbname=" + r.DBName + " port=" + r.Port + " sslmode=disable TimeZone=Asia/Shanghai"
}
type Limit struct {
Request int64
Content int
}
type Cors struct {
Enable bool
AllowOrigins []string
AllowMethods []string
AllowHeaders []string
}