server auth

This commit is contained in:
2026-05-28 08:35:50 -04:00
parent 3d44a392f1
commit fc63f9c44a
37 changed files with 3877 additions and 74 deletions

View File

@@ -9,6 +9,7 @@ import (
"os"
"time"
"github.com/tim/cairnquire/apps/server/internal/auth"
"github.com/tim/cairnquire/apps/server/internal/config"
"github.com/tim/cairnquire/apps/server/internal/database"
"github.com/tim/cairnquire/apps/server/internal/docs"
@@ -61,6 +62,11 @@ func New(ctx context.Context, cfg config.Config, logger *slog.Logger) (*App, err
syncRepo := sync.NewRepository(db.SQL())
syncService := sync.NewService(syncRepo, service, contentStore, cfg.Content.SourceDir, logger)
authRepo := auth.NewRepository(db.SQL())
authService, err := auth.NewService(authRepo, cfg.Auth.PublicOrigin)
if err != nil {
return nil, fmt.Errorf("build auth service: %w", err)
}
handler, err := httpserver.New(httpserver.Dependencies{
Config: cfg,
@@ -71,6 +77,7 @@ func New(ctx context.Context, cfg config.Config, logger *slog.Logger) (*App, err
Hub: hub,
SyncService: syncService,
SyncRepo: syncRepo,
Auth: authService,
})
if err != nil {
return nil, fmt.Errorf("build http handler: %w", err)