Skip to content

Commit c18f8f0

Browse files
committed
fix: auto cert nil ptr issue
1 parent 621772b commit c18f8f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/cert/auto_cert.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,17 @@ func autoCert(certModel *model.Cert) {
7575
ChallengeMethod: certModel.ChallengeMethod,
7676
DNSCredentialID: certModel.DnsCredentialID,
7777
KeyType: certModel.GetKeyType(),
78-
Resource: &model.CertificateResource{
78+
NotBefore: cert.NotBefore,
79+
}
80+
81+
if certModel.Resource != nil {
82+
payload.Resource = &model.CertificateResource{
7983
Resource: certModel.Resource.Resource,
8084
PrivateKey: certModel.Resource.PrivateKey,
8185
Certificate: certModel.Resource.Certificate,
8286
IssuerCertificate: certModel.Resource.IssuerCertificate,
8387
CSR: certModel.Resource.CSR,
84-
},
85-
NotBefore: cert.NotBefore,
88+
}
8689
}
8790

8891
// errChan will be closed inside IssueCert

0 commit comments

Comments
 (0)