73 lines
1.8 KiB
Go
73 lines
1.8 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"donat-widget/infrastructure/sysStorage"
|
|
"donat-widget/internal/app/http"
|
|
"donat-widget/internal/config"
|
|
"donat-widget/internal/docs"
|
|
"donat-widget/pkg/logger"
|
|
)
|
|
|
|
import (
|
|
"donat-widget/infrastructure/pg"
|
|
//"donat-widget/infrastructure/weed"
|
|
AuthClient "donat-widget/pkg/api/auth"
|
|
PaymentClient "donat-widget/pkg/api/payment"
|
|
)
|
|
|
|
import (
|
|
DonatRepo "donat-widget/internal/repository/donat"
|
|
TargetRepo "donat-widget/internal/repository/target"
|
|
WidgetRepo "donat-widget/internal/repository/widget"
|
|
DonatService "donat-widget/internal/service/donat"
|
|
TargetService "donat-widget/internal/service/target"
|
|
WidgetService "donat-widget/internal/service/widget"
|
|
)
|
|
|
|
// @title Donate Auth Documentation
|
|
// @version 3.0
|
|
// @description Donate auth service docs.
|
|
// @BasePath /api/widget
|
|
// @securityDefinitions.apikey BearerAuth
|
|
// @in header
|
|
// @name Authorization
|
|
|
|
func main() {
|
|
logger.New()
|
|
cfg := config.Init()
|
|
docs.SwaggerInfo.Host = cfg.HOST
|
|
|
|
// INFRASTRUCTURE
|
|
db := pg.NewPgPool(context.Background(), cfg.Db.Username, cfg.Db.Password, cfg.Db.Host, cfg.Db.Port, cfg.Db.DBName)
|
|
//storage := weed.NewWeed(cfg.Storage.Filer, cfg.Storage.Master)
|
|
storage := sysStorage.NewLocalStorage("")
|
|
// CLIENTS
|
|
paymentClient := PaymentClient.New(cfg.PaymentService.Host, cfg.PaymentService.Port)
|
|
authClient := AuthClient.New(cfg.AuthService.Host, cfg.AuthService.Port)
|
|
|
|
// REPOSITORIES
|
|
widgetRepo := WidgetRepo.New(db, storage)
|
|
donatRepo := DonatRepo.New(db)
|
|
targetRepo := TargetRepo.New(db)
|
|
|
|
// SERVICES
|
|
widgetService := WidgetService.New(widgetRepo, authClient)
|
|
donatService := DonatService.New(
|
|
donatRepo,
|
|
widgetRepo,
|
|
paymentClient,
|
|
authClient,
|
|
storage,
|
|
)
|
|
targetService := TargetService.New(targetRepo, authClient)
|
|
|
|
http.NewApp(
|
|
db,
|
|
widgetService,
|
|
donatService,
|
|
targetService,
|
|
authClient,
|
|
)
|
|
}
|