-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathserver.go
More file actions
50 lines (39 loc) · 1.12 KB
/
server.go
File metadata and controls
50 lines (39 loc) · 1.12 KB
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
package httpserver
import (
"github.com/devfeel/dotweb"
"github.com/devfeel/longweb/config"
"github.com/devfeel/longweb/framework/log"
"github.com/devfeel/longweb/message"
"strconv"
)
func StartServer() error {
//初始化DotServer
app := dotweb.New()
//设置dotserver日志目录
app.SetLogPath(config.CurrentConfig.Log.FilePath)
app.SetEnabledLog(true)
app.UseRequestLog()
//设置路由
InitRoute(app)
innerLogger := logger.GetInnerLogger()
//启动监控服务
pprofport := config.CurrentConfig.HttpServer.PProfPort
app.SetPProfConfig(true, pprofport)
if config.CurrentConfig.HttpServer.IsTLS {
//设置TLS
app.HttpServer.SetEnabledTLS(true, config.CurrentConfig.HttpServer.TLSCertFile, config.CurrentConfig.HttpServer.TLSKeyFile)
}
// 开始服务
port := config.CurrentConfig.HttpServer.HttpPort
if config.CurrentConfig.HttpServer.IsTLS{
innerLogger.Debug("dotweb.StartServer[Tls] => " + strconv.Itoa(port))
}else {
innerLogger.Debug("dotweb.StartServer => " + strconv.Itoa(port))
}
err := app.StartServer(port)
return err
}
func ReSetServer() {
//初始化应用信息
message.InitAppInfo()
}