|
|
@ -6,7 +6,6 @@ import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
ginSwagger "github.com/swaggo/gin-swagger"
|
|
|
|
ginSwagger "github.com/swaggo/gin-swagger"
|
|
|
|
"github.com/swaggo/gin-swagger/swaggerFiles"
|
|
|
|
"github.com/swaggo/gin-swagger/swaggerFiles"
|
|
|
|
"github.com/taoshihan1991/imaptool/config"
|
|
|
|
|
|
|
|
"github.com/taoshihan1991/imaptool/controller"
|
|
|
|
"github.com/taoshihan1991/imaptool/controller"
|
|
|
|
"github.com/taoshihan1991/imaptool/docs"
|
|
|
|
"github.com/taoshihan1991/imaptool/docs"
|
|
|
|
"github.com/taoshihan1991/imaptool/router"
|
|
|
|
"github.com/taoshihan1991/imaptool/router"
|
|
|
@ -19,13 +18,11 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
Port string
|
|
|
|
Port string
|
|
|
|
tcpport string
|
|
|
|
|
|
|
|
daemon bool
|
|
|
|
daemon bool
|
|
|
|
GoflyConfig *config.Config
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
var serverCmd = &cobra.Command{
|
|
|
|
var serverCmd = &cobra.Command{
|
|
|
|
Use: "server",
|
|
|
|
Use: "server",
|
|
|
|
Short: "example:go-fly server port 8081",
|
|
|
|
Short: "example:go-fly server -p 8081",
|
|
|
|
Example: "go-fly server -c config/",
|
|
|
|
Example: "go-fly server -c config/",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
run()
|
|
|
|
run()
|
|
|
@ -34,7 +31,6 @@ var serverCmd = &cobra.Command{
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
serverCmd.PersistentFlags().StringVarP(&Port, "port", "p", "8081", "监听端口号")
|
|
|
|
serverCmd.PersistentFlags().StringVarP(&Port, "port", "p", "8081", "监听端口号")
|
|
|
|
serverCmd.PersistentFlags().StringVarP(&tcpport, "tcpport", "t", "8082", "监听tcp端口号")
|
|
|
|
|
|
|
|
serverCmd.PersistentFlags().BoolVarP(&daemon, "daemon", "d", false, "是否为守护进程模式")
|
|
|
|
serverCmd.PersistentFlags().BoolVarP(&daemon, "daemon", "d", false, "是否为守护进程模式")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func run() {
|
|
|
|
func run() {
|
|
|
@ -53,7 +49,6 @@ func run() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
baseServer := "0.0.0.0:" + Port
|
|
|
|
baseServer := "0.0.0.0:" + Port
|
|
|
|
//tcpBaseServer := "0.0.0.0:"+tcpport
|
|
|
|
|
|
|
|
controller.Port = Port
|
|
|
|
controller.Port = Port
|
|
|
|
log.Println("start server...\r\ngo:http://" + baseServer)
|
|
|
|
log.Println("start server...\r\ngo:http://" + baseServer)
|
|
|
|
engine := gin.Default()
|
|
|
|
engine := gin.Default()
|
|
|
|