wip: 周天,继续

This commit is contained in:
loveuer
2024-10-27 21:47:57 +08:00
parent 4822fbc092
commit ef6cca510a
12 changed files with 252 additions and 82 deletions

View File

@ -5,6 +5,7 @@ import (
"uauth/internal/opt"
"uauth/internal/serve"
"uauth/internal/store/cache"
"uauth/internal/store/db"
"uauth/internal/tool"
)
@ -14,6 +15,7 @@ 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))
return serve.Run(cmd.Context())
},
}
@ -21,6 +23,7 @@ func initServe() *cobra.Command {
svc.Flags().StringVar(&opt.Cfg.Svc.Address, "address", "localhost:8080", "listen address")
svc.Flags().StringVar(&opt.Cfg.Svc.Prefix, "prefix", "/api/oauth/v2", "api prefix")
svc.Flags().StringVar(&opt.Cfg.Svc.Cache, "cache", "lru::", "cache uri")
svc.Flags().StringVar(&opt.Cfg.Svc.DB, "db", "sqlite::data.sqlite", "database uri")
return svc
}