You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cls/cmd/run.go

41 lines
792 B
Go

package cmd
import (
"cls/config"
"cls/internal/interfaces"
"cls/internal/modules"
"cls/pkg/captchafx"
"cls/pkg/fxevent"
_ "embed"
"github.com/urfave/cli/v2"
"go.uber.org/fx"
)
func runServer(*cli.Context) error {
fx.New(
fx.WithLogger(fxevent.NewLogrusLogger),
fx.Provide(
config.NewAppConfig,
config.NewLoggerFactory,
config.NewGinEngine,
config.NewXormEngine,
config.NewClickhouseConn,
config.NewRedisClient,
config.NewPasswordEncoder,
config.NewSmsService,
config.NewInternalClient,
config.NewJWTAuthMiddleware,
config.NewPayService,
), // 基础服务
fx.Options(captchafx.Module),
fx.Invoke(
interfaces.RegisterHandlers,
), // 注册http handler
fx.Options(
modules.Module, // 总模块入口
),
).Run()
return nil
}