forked from guchengwuyue/yshop-gin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
59 lines (49 loc) · 1.26 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"github.com/spf13/cobra"
"os"
"yixiang.co/go-mall/app/listen"
"yixiang.co/go-mall/app/models"
"yixiang.co/go-mall/cmd"
"yixiang.co/go-mall/pkg/config"
"yixiang.co/go-mall/pkg/console"
"yixiang.co/go-mall/pkg/global"
"yixiang.co/go-mall/pkg/jwt"
"yixiang.co/go-mall/pkg/logging"
"yixiang.co/go-mall/pkg/redis"
"yixiang.co/go-mall/pkg/wechat"
)
func init() {
global.YSHOP_VP = config.Viper()
global.YSHOP_LOG = logging.SetupLogger()
models.Setup()
logging.Setup()
redis.Setup()
jwt.Setup()
listen.Setup()
wechat.InitWechat()
}
// @title gin-shop API
// @version 1.0
// @description gin-shop商城后台管理系统
// @termsOfService https://gitee.com/guchengwuyue/gin-shop
// @license.name apache2
func main() {
var rootCmd = &cobra.Command{
Use: "yshop=gin",
Short: "gin商城系统r",
Long: "will run serve command",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
},
}
rootCmd.AddCommand(cmd.CmdServe)
// 配置默认运行 Web 服务
cmd.RegisterDefaultCmd(rootCmd, cmd.CmdServe)
// 注册全局参数,--env
cmd.RegisterGlobalFlags(rootCmd)
// 执行主命令
if err := rootCmd.Execute(); err != nil {
console.Exit(fmt.Sprintf("Failed to run app with %v: %s", os.Args, err.Error()))
}
}