sso/internal/app/app.go

29 lines
509 B
Go
Raw Permalink Normal View History

2023-12-17 12:17:55 +02:00
package app
import (
"log/slog"
grpcapp "sso/internal/app/grpc"
"sso/internal/services/auth"
"sso/internal/storage/sqlite"
"time"
)
type App struct {
GRPCSrv *grpcapp.App
}
func New(log *slog.Logger, grpcPort int, storagePath string, tokenTTL time.Duration) *App {
storage, err := sqlite.New(storagePath)
if err != nil {
panic(err)
}
authService := auth.New(log, storage, storage, storage, tokenTTL)
grpcApp := grpcapp.New(log, authService, grpcPort)
return &App{
GRPCSrv: grpcApp,
}
}