@@ -7,7 +7,7 @@ use tokio::sync::mpsc;
7
7
use tokio_rustls:: rustls:: {
8
8
crypto:: CryptoProvider , server:: ResolvesServerCert , sign:: CertifiedKey ,
9
9
} ;
10
- use x509_cert:: Certificate ;
10
+ use x509_cert:: { Certificate , certificate :: CertificateInner } ;
11
11
12
12
use super :: { WEBHOOK_CA_LIFETIME , WEBHOOK_CERTIFICATE_LIFETIME } ;
13
13
@@ -78,10 +78,7 @@ impl CertificateResolver {
78
78
. await
79
79
. context ( GenerateNewCertificateSnafu ) ?;
80
80
81
- cert_tx
82
- . send ( cert)
83
- . await
84
- . map_err ( |_err| CertificateResolverError :: SendCertificateToChannel ) ?;
81
+ Self :: send_certificate_to_channel ( cert, & cert_tx) . await ?;
85
82
86
83
Ok ( Self {
87
84
subject_alterative_dns_names,
@@ -98,11 +95,7 @@ impl CertificateResolver {
98
95
99
96
// TODO: Sign the new cert somehow with the old cert. See https://github.com/stackabletech/decisions/issues/56
100
97
101
- self . cert_tx
102
- . send ( cert)
103
- . await
104
- . map_err ( |_err| CertificateResolverError :: SendCertificateToChannel ) ?;
105
-
98
+ Self :: send_certificate_to_channel ( cert, & self . cert_tx ) . await ?;
106
99
self . current_certified_key . store ( certified_key) ;
107
100
108
101
Ok ( ( ) )
@@ -151,6 +144,16 @@ impl CertificateResolver {
151
144
. await
152
145
. context ( TokioSpawnBlockingSnafu ) ?
153
146
}
147
+
148
+ async fn send_certificate_to_channel (
149
+ cert : CertificateInner ,
150
+ cert_tx : & mpsc:: Sender < Certificate > ,
151
+ ) -> Result < ( ) > {
152
+ cert_tx
153
+ . send ( cert)
154
+ . await
155
+ . map_err ( |_err| CertificateResolverError :: SendCertificateToChannel )
156
+ }
154
157
}
155
158
156
159
impl ResolvesServerCert for CertificateResolver {
0 commit comments