Browse Source

增加了 配置管理功能

main
pixel 5 years ago
parent
commit
78209ed65d
  1. 32
      QMPlusServer/cmd/linux.go
  2. 3
      QMPlusServer/main.go

32
QMPlusServer/cmd/linux.go

@ -1,32 +0,0 @@
package cmd
import (
"fmt"
"gin-vue-admin/config"
"github.com/fvbock/endless"
"github.com/gin-gonic/gin"
"syscall"
"time"
)
func RunLinuxServer(Router *gin.Engine) {
endless.DefaultReadTimeOut = 10 * time.Second
endless.DefaultWriteTimeOut = 10 * time.Second
endless.DefaultMaxHeaderBytes = 1 << 20
endPoint := fmt.Sprintf(":%d", config.GinVueAdminconfig.System.Addr)
server := endless.NewServer(endPoint, Router)
server.BeforeBegin = func(add string) {
fmt.Printf(`欢迎使用 Gin-Vue-Admin
作者奇淼 And Spike666
微信shouzi_1994
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:8080
Actual pid is %d
`, fmt.Sprintf(":%d", config.GinVueAdminconfig.System.Addr), syscall.Getpid())
}
err := server.ListenAndServe()
if err != nil {
fmt.Printf("Server err: %v", err)
}
}

3
QMPlusServer/main.go

@ -32,9 +32,10 @@ func main() {
qmlog.QMLog.Info("服务器开启") // 日志测试代码 qmlog.QMLog.Info("服务器开启") // 日志测试代码
//Router.RunTLS(":443","ssl.pem", "ssl.key") // https支持 需要添加中间件 //Router.RunTLS(":443","ssl.pem", "ssl.key") // https支持 需要添加中间件
sysType := runtime.GOOS sysType := runtime.GOOS
if sysType == "linux" { if sysType == "linux" {
// LINUX系统 // LINUX系统
cmd.RunLinuxServer(Router)
// 借助endless开发无感知重启后台 以及前端接口重启后台功能
} }
if sysType == "windows" { if sysType == "windows" {
// WIN系统 // WIN系统

Loading…
Cancel
Save