structure: 确定基本结构(保持基本形式, 采用组合)
This commit is contained in:
@ -4,10 +4,11 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"uauth/internal/opt"
|
||||
"uauth/internal/serve"
|
||||
"uauth/internal/store/cache"
|
||||
"uauth/internal/store/db"
|
||||
"uauth/internal/tool"
|
||||
"uauth/model"
|
||||
"uauth/pkg/cache"
|
||||
"uauth/pkg/rbac"
|
||||
"uauth/pkg/store"
|
||||
"uauth/tool"
|
||||
)
|
||||
|
||||
func initServe() *cobra.Command {
|
||||
@ -16,8 +17,9 @@ func initServe() *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
tool.TablePrinter(opt.Cfg)
|
||||
tool.Must(cache.Init(opt.Cfg.Svc.Cache))
|
||||
tool.Must(db.Init(cmd.Context(), opt.Cfg.Svc.DB))
|
||||
tool.Must(model.Init(db.Default.Session()))
|
||||
tool.Must(store.Init(opt.Cfg.Svc.DB, store.Config{Debug: opt.Cfg.Debug}))
|
||||
tool.Must(model.Init(store.Default.Session(tool.Timeout())))
|
||||
tool.Must(rbac.Init(store.Default, cache.Client))
|
||||
return serve.Run(cmd.Context())
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user