This commit is contained in:
eson
2023-08-29 14:19:47 +08:00
parent 79b6277332
commit 3103d69bae
8 changed files with 136 additions and 39 deletions

View File

@@ -22,8 +22,8 @@ type ServiceContext struct {
MysqlConn *gorm.DB
AllModels *gmodel.AllModelsGen
RegisterTokenManger *auth.ConfirmationLink[auth.RegisterToken]
ResetTokenManger *auth.ConfirmationLink[auth.ResetToken]
OAuthTokenManger *auth.ConfirmationLink[auth.RegisterToken]
ResetTokenManger *auth.ConfirmationLink[auth.ResetToken]
}
func NewServiceContext(c config.Config) *ServiceContext {
@@ -31,12 +31,12 @@ func NewServiceContext(c config.Config) *ServiceContext {
// StateServer := shared.StartNode(c.ReplicaId, autoconfig.AutoGetAllServerConfig(), conn)
registerAddress := fmt.Sprintf("%s/api/auth/email/confirmation", c.MainAddress)
return &ServiceContext{
Config: c,
MysqlConn: conn,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
RegisterTokenManger: auth.NewConfirmationLink[auth.RegisterToken](c.Auth.AccessSecret, registerAddress),
ResetTokenManger: auth.NewConfirmationLink[auth.ResetToken](c.Auth.AccessSecret, registerAddress),
Config: c,
MysqlConn: conn,
SharedState: nil,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
OAuthTokenManger: auth.NewConfirmationLink[auth.RegisterToken](c.Auth.AccessSecret, registerAddress),
ResetTokenManger: auth.NewConfirmationLink[auth.ResetToken](c.Auth.AccessSecret, registerAddress),
}
}