package setup import ( "context" "forge.cadoles.com/wpetit/clearcase/internal/config" "forge.cadoles.com/wpetit/clearcase/internal/core/model" "forge.cadoles.com/wpetit/clearcase/internal/core/port" "forge.cadoles.com/wpetit/clearcase/internal/core/service" "forge.cadoles.com/wpetit/clearcase/internal/http/handler/webui/issue" "github.com/pkg/errors" ) func NewIssueHandlerFromConfig(ctx context.Context, conf *config.Config) (*issue.Handler, error) { forgeManager, err := NewForgeManagerFromConfig(ctx, conf) if err != nil { return nil, errors.WithStack(err) } return issue.NewHandler(forgeManager), nil } type authProviderBasedForgeFactory struct { provider string create func(ctx context.Context, user *model.User) (port.Forge, error) } // Create implements service.ForgeFactory. func (a *authProviderBasedForgeFactory) Create(ctx context.Context, user *model.User) (port.Forge, error) { forge, err := a.create(ctx, user) if err != nil { return nil, errors.WithStack(err) } return forge, nil } // Match implements service.ForgeFactory. func (a *authProviderBasedForgeFactory) Match(user *model.User) bool { return user.Provider == a.provider } var _ service.ForgeFactory = &authProviderBasedForgeFactory{}