@@ -76,7 +76,7 @@ func (h *ACMEChallengeHandler) getKeyAuthForToken(ctx context.Context, token str
|
||||
|
||||
err := h.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
func(ctx context.Context, conn pg.Querier) error {
|
||||
domain := &coredata.CustomDomain{}
|
||||
if err := domain.LoadByHTTPChallengeToken(ctx, conn, coredata.NewNoScope(), token); err != nil {
|
||||
return err
|
||||
|
||||
@@ -51,7 +51,7 @@ func (w *CacheStore) WarmCache(ctx context.Context) error {
|
||||
|
||||
err := w.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
func(ctx context.Context, conn pg.Querier) error {
|
||||
domains := coredata.CustomDomains{}
|
||||
if err := domains.LoadActiveCertificates(ctx, conn, coredata.NewNoScope()); err != nil {
|
||||
return fmt.Errorf("cannot load active certificates: %w", err)
|
||||
@@ -93,7 +93,7 @@ func (w *CacheStore) WarmCache(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *CacheStore) warmDomain(ctx context.Context, conn pg.Conn, domain *coredata.CustomDomain) error {
|
||||
func (w *CacheStore) warmDomain(ctx context.Context, conn pg.Querier, domain *coredata.CustomDomain) error {
|
||||
var loadedDomain coredata.CustomDomain
|
||||
if err := loadedDomain.LoadByID(ctx, conn, coredata.NewNoScope(), domain.ID); err != nil {
|
||||
return fmt.Errorf("cannot load domain with decrypted values: %w", err)
|
||||
|
||||
@@ -189,7 +189,7 @@ func (p *Provisioner) checkCAARecords(domain string) error {
|
||||
func (p *Provisioner) checkPendingDomains(ctx context.Context) error {
|
||||
err := p.pg.WithTx(
|
||||
ctx,
|
||||
func(tx pg.Conn) error {
|
||||
func(ctx context.Context, tx pg.Tx) error {
|
||||
if err := p.handleStaleProvisioningAttempts(ctx, tx); err != nil {
|
||||
return fmt.Errorf("cannot handle stale provisioning attempts: %w", err)
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func (p *Provisioner) checkPendingDomains(ctx context.Context) error {
|
||||
|
||||
err = p.pg.WithTx(
|
||||
ctx,
|
||||
func(tx pg.Conn) error {
|
||||
func(ctx context.Context, tx pg.Tx) error {
|
||||
var domains coredata.CustomDomains
|
||||
if err := domains.ListDomainsWithPendingHTTPChallenges(ctx, tx, coredata.NewNoScope()); err != nil {
|
||||
return fmt.Errorf("cannot load domains with pending challenges: %w", err)
|
||||
@@ -243,7 +243,7 @@ func (p *Provisioner) checkPendingDomains(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Provisioner) handleStaleProvisioningAttempts(ctx context.Context, tx pg.Conn) error {
|
||||
func (p *Provisioner) handleStaleProvisioningAttempts(ctx context.Context, tx pg.Tx) error {
|
||||
var domains coredata.CustomDomains
|
||||
if err := domains.ListStaleProvisioningDomains(ctx, tx, coredata.NewNoScope()); err != nil {
|
||||
return fmt.Errorf("cannot load stale provisioning domains: %w", err)
|
||||
@@ -271,7 +271,7 @@ func (p *Provisioner) handleStaleProvisioningAttempts(ctx context.Context, tx pg
|
||||
|
||||
func (p *Provisioner) resetStaleDomain(
|
||||
ctx context.Context,
|
||||
tx pg.Conn,
|
||||
tx pg.Tx,
|
||||
domain *coredata.CustomDomain,
|
||||
) error {
|
||||
fullDomain := &coredata.CustomDomain{}
|
||||
@@ -320,7 +320,7 @@ func (p *Provisioner) resetStaleDomain(
|
||||
|
||||
func (p *Provisioner) provisionDomainCertificate(
|
||||
ctx context.Context,
|
||||
tx pg.Conn,
|
||||
tx pg.Tx,
|
||||
domainID gid.GID,
|
||||
) error {
|
||||
domain := &coredata.CustomDomain{}
|
||||
|
||||
@@ -76,7 +76,7 @@ func (r *Renewer) Run(ctx context.Context) error {
|
||||
func (r *Renewer) checkAndRenew(ctx context.Context) error {
|
||||
return r.pg.WithTx(
|
||||
ctx,
|
||||
func(tx pg.Conn) error {
|
||||
func(ctx context.Context, tx pg.Tx) error {
|
||||
var caches coredata.CachedCertificates
|
||||
cacheCount, err := caches.CountAll(ctx, tx)
|
||||
if err != nil {
|
||||
@@ -128,7 +128,7 @@ func (r *Renewer) checkAndRenew(ctx context.Context) error {
|
||||
)
|
||||
}
|
||||
|
||||
func (r *Renewer) renewDomain(ctx context.Context, tx pg.Conn, domainID gid.GID) error {
|
||||
func (r *Renewer) renewDomain(ctx context.Context, tx pg.Tx, domainID gid.GID) error {
|
||||
domain := &coredata.CustomDomain{}
|
||||
if err := domain.LoadByIDForUpdateSkipLocked(ctx, tx, coredata.NewNoScope(), domainID); err != nil {
|
||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||
|
||||
@@ -80,7 +80,7 @@ func (s *Selector) loadFromDatabase(domain string) (*tls.Certificate, error) {
|
||||
var cert *tls.Certificate
|
||||
err := s.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
func(ctx context.Context, conn pg.Querier) error {
|
||||
var cache coredata.CachedCertificate
|
||||
if err := cache.LoadByDomain(ctx, conn, domain); err != nil {
|
||||
if err := s.rebuildCacheEntry(ctx, conn, domain); err != nil {
|
||||
@@ -114,7 +114,7 @@ func (s *Selector) loadFromDatabase(domain string) (*tls.Certificate, error) {
|
||||
return cert, nil
|
||||
}
|
||||
|
||||
func (s *Selector) rebuildCacheEntry(ctx context.Context, conn pg.Conn, domain string) error {
|
||||
func (s *Selector) rebuildCacheEntry(ctx context.Context, conn pg.Querier, domain string) error {
|
||||
var customDomain coredata.CustomDomain
|
||||
if err := customDomain.LoadByDomain(ctx, conn, coredata.NewNoScope(), domain); err != nil {
|
||||
return fmt.Errorf("cannot load domain: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user