beego: BeegoServerName & beego.Run
BeegoServerName change to beegoServer+Version beego.Run(“:8089”)
Showing
2 changed files
with
15 additions
and
3 deletions
| ... | @@ -284,8 +284,19 @@ func AddAPPStartHook(hf hookfunc) { | ... | @@ -284,8 +284,19 @@ func AddAPPStartHook(hf hookfunc) { |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | // Run beego application. | 286 | // Run beego application. |
| 287 | // it's alias of App.Run. | 287 | // beego.Run() default run on HttpPort |
| 288 | func Run() { | 288 | // beego.Run(":8089") |
| 289 | // beego.Run("127.0.0.1:8089") | ||
| 290 | func Run(params ...string) { | ||
| 291 | if len(params) > 0 && params[0] != "" { | ||
| 292 | strs := strings.Split(params[0], ":") | ||
| 293 | if len(strs) > 0 && strs[0] != "" { | ||
| 294 | HttpAddr = strs[0] | ||
| 295 | } | ||
| 296 | if len(strs) > 1 && strs[1] != "" { | ||
| 297 | HttpPort, _ = strconv.Atoi(strs[1]) | ||
| 298 | } | ||
| 299 | } | ||
| 289 | initBeforeHttpRun() | 300 | initBeforeHttpRun() |
| 290 | 301 | ||
| 291 | if EnableAdmin { | 302 | if EnableAdmin { |
| ... | @@ -346,6 +357,7 @@ func initBeforeHttpRun() { | ... | @@ -346,6 +357,7 @@ func initBeforeHttpRun() { |
| 346 | middleware.RegisterErrorHandler() | 357 | middleware.RegisterErrorHandler() |
| 347 | } | 358 | } |
| 348 | 359 | ||
| 360 | // this function is for test package init | ||
| 349 | func TestBeegoInit(apppath string) { | 361 | func TestBeegoInit(apppath string) { |
| 350 | AppPath = apppath | 362 | AppPath = apppath |
| 351 | AppConfigPath = filepath.Join(AppPath, "conf", "app.conf") | 363 | AppConfigPath = filepath.Join(AppPath, "conf", "app.conf") | ... | ... |
| ... | @@ -142,7 +142,7 @@ func init() { | ... | @@ -142,7 +142,7 @@ func init() { |
| 142 | TemplateLeft = "{{" | 142 | TemplateLeft = "{{" |
| 143 | TemplateRight = "}}" | 143 | TemplateRight = "}}" |
| 144 | 144 | ||
| 145 | BeegoServerName = "beegoServer" | 145 | BeegoServerName = "beegoServer:" + VERSION |
| 146 | 146 | ||
| 147 | EnableAdmin = false | 147 | EnableAdmin = false |
| 148 | AdminHttpAddr = "127.0.0.1" | 148 | AdminHttpAddr = "127.0.0.1" | ... | ... |
-
Please register or sign in to post a comment