mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-07 21:19:51 +00:00
feat: 根据输入的参数,显示不同的内容
This commit is contained in:
parent
0c35928eee
commit
265842feeb
2
Makefile
2
Makefile
@ -37,4 +37,4 @@ help:
|
||||
.PHONY: all build clean help
|
||||
|
||||
local.run:
|
||||
go mod vendor&& npm --prefix ./ui install && npm --prefix ./ui run build && go run main.go serve
|
||||
go mod vendor&& npm --prefix ./ui install && npm --prefix ./ui run build && go run main.go serve --http 127.0.0.1:8090
|
||||
|
9
main.go
9
main.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
@ -25,6 +26,12 @@ func main() {
|
||||
|
||||
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
||||
|
||||
// 获取启动命令中的http参数
|
||||
var httpFlag string
|
||||
flag.StringVar(&httpFlag, "http", "127.0.0.1:8090", "HTTP server address")
|
||||
// "serve"影响解析
|
||||
_ = flag.CommandLine.Parse(os.Args[2:])
|
||||
|
||||
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
|
||||
// enable auto creation of migration files when making collection changes in the Admin UI
|
||||
// (the isGoRun check is to enable it only during development)
|
||||
@ -48,7 +55,7 @@ func main() {
|
||||
})
|
||||
|
||||
defer log.Println("Exit!")
|
||||
log.Println("Visit the website:", "http://127.0.0.1:8090")
|
||||
log.Printf("Visit the website: http://%s", httpFlag)
|
||||
|
||||
if err := app.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user