1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-18 05:30:55 +00:00

Merge pull request #1906 from Maxgis/issue_redundancy

remove redundancy code and add port confict tip
This commit is contained in:
astaxie 2016-04-28 09:59:47 +08:00
commit 73f499948a

4
app.go
View File

@ -139,12 +139,14 @@ func (app *App) Run() {
}
// run normal mode
app.Server.Addr = addr
if BConfig.Listen.EnableHTTPS {
go func() {
time.Sleep(20 * time.Microsecond)
if BConfig.Listen.HTTPSPort != 0 {
app.Server.Addr = fmt.Sprintf("%s:%d", BConfig.Listen.HTTPSAddr, BConfig.Listen.HTTPSPort)
} else if BConfig.Listen.EnableHTTP {
BeeLogger.Info("Start https server error, confict with http.Please reset https port")
return
}
logs.Info("https server Running on %s", app.Server.Addr)
if err := app.Server.ListenAndServeTLS(BConfig.Listen.HTTPSCertFile, BConfig.Listen.HTTPSKeyFile); err != nil {