mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 18:40:55 +00:00
more clean code
This commit is contained in:
parent
8df2cca627
commit
2a96f33543
14
beego.go
14
beego.go
@ -15,6 +15,7 @@
|
|||||||
package beego
|
package beego
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -45,14 +46,11 @@ func AddAPPStartHook(hf hookfunc) {
|
|||||||
func Run(params ...string) {
|
func Run(params ...string) {
|
||||||
initBeforeHTTPRun()
|
initBeforeHTTPRun()
|
||||||
|
|
||||||
if len(params) > 0 && params[0] != "" {
|
params = append(params, fmt.Sprintf("%s:%d", HTTPAddr, HTTPPort))
|
||||||
strs := strings.Split(params[0], ":")
|
addr := strings.Split(params[0], ":")
|
||||||
if len(strs) > 0 && strs[0] != "" {
|
if len(addr) == 2 {
|
||||||
HTTPAddr = strs[0]
|
HTTPAddr = addr[0]
|
||||||
}
|
HTTPPort, _ = strconv.Atoi(addr[1])
|
||||||
if len(strs) > 1 && strs[1] != "" {
|
|
||||||
HTTPPort, _ = strconv.Atoi(strs[1])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BeeApp.Run()
|
BeeApp.Run()
|
||||||
|
Loading…
Reference in New Issue
Block a user