91 lines
2.8 KiB
Go
91 lines
2.8 KiB
Go
// Code generated by Wire. DO NOT EDIT.
|
|
|
|
//go:generate go run github.com/google/wire/cmd/wire
|
|
//go:build !wireinject
|
|
// +build !wireinject
|
|
|
|
package server
|
|
|
|
import (
|
|
"context"
|
|
"github.com/google/wire"
|
|
"github.com/xmdhs/authlib-skin/config"
|
|
"github.com/xmdhs/authlib-skin/handle"
|
|
"github.com/xmdhs/authlib-skin/handle/handelerror"
|
|
yggdrasil2 "github.com/xmdhs/authlib-skin/handle/yggdrasil"
|
|
"github.com/xmdhs/authlib-skin/server/route"
|
|
"github.com/xmdhs/authlib-skin/service"
|
|
"github.com/xmdhs/authlib-skin/service/auth"
|
|
"github.com/xmdhs/authlib-skin/service/captcha"
|
|
"github.com/xmdhs/authlib-skin/service/email"
|
|
"github.com/xmdhs/authlib-skin/service/yggdrasil"
|
|
"net/http"
|
|
)
|
|
|
|
import (
|
|
_ "github.com/go-sql-driver/mysql"
|
|
)
|
|
|
|
// Injectors from wire.go:
|
|
|
|
func InitializeRoute(ctx context.Context, c config.Config) (*http.Server, func(), error) {
|
|
handler := ProvideSlog(c)
|
|
logger := NewSlog(handler)
|
|
validate := ProvideValidate()
|
|
db, cleanup, err := ProvideDB(c)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
client, cleanup2, err := ProvideEnt(ctx, db, c, logger)
|
|
if err != nil {
|
|
cleanup()
|
|
return nil, nil, err
|
|
}
|
|
cache := ProvideCache(c)
|
|
privateKey, err := ProvidePriKey(c)
|
|
if err != nil {
|
|
cleanup2()
|
|
cleanup()
|
|
return nil, nil, err
|
|
}
|
|
publicKey := ProvidePubKey(privateKey)
|
|
authService := auth.NewAuthService(client, cache, publicKey, privateKey)
|
|
yggdrasilYggdrasil := yggdrasil.NewYggdrasil(client, cache, c, privateKey, authService)
|
|
pubRsaKey, err := ProvidePubKeyStr(privateKey)
|
|
if err != nil {
|
|
cleanup2()
|
|
cleanup()
|
|
return nil, nil, err
|
|
}
|
|
yggdrasil3 := yggdrasil2.NewYggdrasil(logger, validate, yggdrasilYggdrasil, c, pubRsaKey)
|
|
webService := service.NewWebService(c)
|
|
handel := handle.NewHandel(webService)
|
|
handleError := handelerror.NewHandleError(logger)
|
|
httpClient := ProvideHttpClient()
|
|
captchaService := captcha.NewCaptchaService(c, httpClient)
|
|
emailService, err := email.NewEmail(privateKey, c, cache)
|
|
if err != nil {
|
|
cleanup2()
|
|
cleanup()
|
|
return nil, nil, err
|
|
}
|
|
userService := service.NewUserSerice(c, client, captchaService, authService, cache, emailService)
|
|
textureService := service.NewTextureService(client, c, cache)
|
|
userHandel := handle.NewUserHandel(handleError, validate, userService, logger, textureService, c)
|
|
adminService := service.NewAdminService(authService, client, c, cache)
|
|
adminHandel := handle.NewAdminHandel(handleError, adminService, validate)
|
|
httpHandler := route.NewRoute(yggdrasil3, handel, c, handler, userHandel, adminHandel)
|
|
server, cleanup3 := NewServer(c, httpHandler)
|
|
return server, func() {
|
|
cleanup3()
|
|
cleanup2()
|
|
cleanup()
|
|
}, nil
|
|
}
|
|
|
|
// wire.go:
|
|
|
|
var serviceSet = wire.NewSet(service.Service, yggdrasil.NewYggdrasil, email.NewEmail, auth.NewAuthService, captcha.NewCaptchaService)
|
|
|
|
var handleSet = wire.NewSet(handelerror.NewHandleError, handle.HandelSet, yggdrasil2.NewYggdrasil)
|