mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:40:55 +00:00
// beego.Run("localhost")
This commit is contained in:
parent
caf3714495
commit
69bee9ef3c
16
beego.go
16
beego.go
@ -15,11 +15,11 @@
|
||||
package beego
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// beego web framework version.
|
||||
@ -41,16 +41,20 @@ func AddAPPStartHook(hf hookfunc) {
|
||||
|
||||
// Run beego application.
|
||||
// beego.Run() default run on HttpPort
|
||||
// beego.Run("localhost")
|
||||
// beego.Run(":8089")
|
||||
// beego.Run("127.0.0.1:8089")
|
||||
func Run(params ...string) {
|
||||
initBeforeHTTPRun()
|
||||
|
||||
params = append(params, fmt.Sprintf("%s:%d", HTTPAddr, HTTPPort))
|
||||
addr := strings.Split(params[0], ":")
|
||||
if len(addr) == 2 {
|
||||
HTTPAddr = addr[0]
|
||||
HTTPPort, _ = strconv.Atoi(addr[1])
|
||||
if len(params) > 0 && params[0] != "" {
|
||||
strs := strings.Split(params[0], ":")
|
||||
if len(strs) > 0 && strs[0] != "" {
|
||||
HTTPAddr = strs[0]
|
||||
}
|
||||
if len(strs) > 1 && strs[1] != "" {
|
||||
HTTPPort, _ = strconv.Atoi(strs[1])
|
||||
}
|
||||
}
|
||||
|
||||
BeeApp.Run()
|
||||
|
Loading…
Reference in New Issue
Block a user