Skip to content

Commit

Permalink
增加app运行模式
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaksam committed Dec 13, 2017
1 parent 1d4731c commit 812b173
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions go/config/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func init() {
flag.BoolVar(&AppConf.Debug, "debug", false, "调试模式,默认:false")
flag.StringVar(&AppConf.IP, "ip", "", "监听的IP地址,默认:127.0.0.1")
flag.IntVar(&AppConf.Port, "port", 0, "服务端口,默认:随机")
// flag.StringVar(&mode, "mode", "web", "运行模式:server:API服务模式;web:Web模式;app:App模式(试验),默认:web")
flag.StringVar(&mode, "mode", "web", "运行模式:server:API服务模式;web:Web模式;默认:web")
flag.StringVar(&mode, "mode", "app", "运行模式:server:API服务模式;web:Web模式;app:App模式(试验),默认:app")
// flag.StringVar(&mode, "mode", "web", "运行模式:server:API服务模式;web:Web模式;默认:web")
flag.StringVar(&AppConf.PrefixPath, "prefix", "", "Web模式下有效,WebUI的路径前缀,默认为空")
flag.StringVar(&AppConf.Token, "token", "", "API授权令牌,为空时不校验,默认为空")
flag.Parse()
Expand Down Expand Up @@ -47,7 +47,7 @@ func init() {
}

AppConf.Name = "dproxy"
AppConf.Version = "0.3.3"
AppConf.Version = "0.4.0"
AppConf.Started = time.Now().Unix()
}

Expand Down
18 changes: 9 additions & 9 deletions go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
_ "github.com/zaaksam/dproxy/go/db"
_ "github.com/zaaksam/dproxy/go/routers"
"github.com/zaaksam/dproxy/go/services"
"github.com/zserge/webview"
)

func main() {
Expand Down Expand Up @@ -48,17 +49,16 @@ func main() {
go openBrowser()

beego.Run()
}
// else if config.AppConf.IsAppMode {
// logs.Info("====== 欢迎使用 " + config.AppConf.Name + " " + config.AppConf.Version + " (App模式) ,关闭此窗口即可退出程序 ======")
} else if config.AppConf.IsAppMode {
logs.Info("====== 欢迎使用 " + config.AppConf.Name + " " + config.AppConf.Version + " (App模式) ,关闭此窗口即可退出程序 ======")

// go beego.Run()
go beego.Run()

// err := webview.Open("DProxy", fmt.Sprintf("http://%s:%d/web", config.AppConf.IP, config.AppConf.Port), 960, 600, false)
// if err != nil {
// logs.Critical("webview启动失败:", err)
// }
// }
err := webview.Open("DProxy", fmt.Sprintf("http://%s:%d/web", config.AppConf.IP, config.AppConf.Port), 960, 600, false)
if err != nil {
logs.Critical("webview启动失败:", err)
}
}
}

func openBrowser() {
Expand Down

0 comments on commit 812b173

Please sign in to comment.