-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
68 lines (56 loc) · 1.64 KB
/
main.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
package main
import (
"GRE3000/const_conf"
"GRE3000/models"
_ "GRE3000/routers"
"time"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
_ "github.com/lib/pq"
_ "GRE3000/base/cache"
_ "GRE3000/templates"
_ "GRE3000/utils"
)
func init() {
beego.LoadAppConfig("ini", const_conf.BeeGoConfiguration)
beego.SetLogger(const_conf.LogsMethod, const_conf.LogsConfig)
beego.BConfig.EnableGzip = true
orm.RegisterDataBase(
const_conf.BeeGoOrmAlias, const_conf.DatabaseType, const_conf.DbSource,
const_conf.BeeGoOrmMaxIdle, const_conf.BeeGoOrmMaxConn,
)
orm.RegisterModel(
new(models.Common),
new(models.WordsList),
new(models.UserLogs),
new(models.UserWordsStudy),
new(models.User),
new(models.Topic),
new(models.Section),
new(models.Reply),
new(models.ReplyUpLog),
new(models.Role),
new(models.Permission),
)
orm.DefaultTimeLoc = time.UTC
orm.RunSyncdb(const_conf.BeeGoOrmAlias, false, true)
orm.Debug = false
beego.BConfig.Listen.EnableHTTP = const_conf.IsEnableHTTP
beego.BConfig.Listen.HTTPPort = const_conf.HttpPort
if const_conf.IsEnableHTTPS {
beego.BConfig.Listen.EnableHTTPS = const_conf.IsEnableHTTPS
beego.BConfig.Listen.HTTPSPort = const_conf.HttpsPort
beego.BConfig.Listen.HTTPSCertFile = const_conf.SSLCertFile
beego.BConfig.Listen.HTTPSKeyFile = const_conf.SSLKeyFile
}
if const_conf.IsEnableXSRF {
beego.BConfig.WebConfig.EnableXSRF = const_conf.IsEnableXSRF
beego.BConfig.WebConfig.XSRFKey = const_conf.BeeGoXSRFKey
beego.BConfig.WebConfig.XSRFExpire = const_conf.BeeGoXSRFExpire
}
beego.BConfig.WebConfig.ViewsPath = const_conf.BeeGoViewsPath
models.Init()
}
func main() {
beego.Run()
}