@@ -28,6 +28,8 @@ pub struct AcmeClient {
2828 credentials : Credentials ,
2929 dns01_client : Dns01Client ,
3030 max_dns_wait : Duration ,
31+ /// TTL for DNS TXT records used in ACME challenges (in seconds).
32+ dns_txt_ttl : u32 ,
3133}
3234
3335#[ derive( Debug , Clone ) ]
@@ -58,6 +60,7 @@ impl AcmeClient {
5860 dns01_client : Dns01Client ,
5961 encoded_credentials : & str ,
6062 max_dns_wait : Duration ,
63+ dns_txt_ttl : u32 ,
6164 ) -> Result < Self > {
6265 let credentials: Credentials = serde_json:: from_str ( encoded_credentials) ?;
6366 let account = Account :: from_credentials ( credentials. credentials ) . await ?;
@@ -67,6 +70,7 @@ impl AcmeClient {
6770 dns01_client,
6871 credentials,
6972 max_dns_wait,
73+ dns_txt_ttl,
7074 } )
7175 }
7276
@@ -75,6 +79,7 @@ impl AcmeClient {
7579 acme_url : & str ,
7680 dns01_client : Dns01Client ,
7781 max_dns_wait : Duration ,
82+ dns_txt_ttl : u32 ,
7883 ) -> Result < Self > {
7984 let ( account, credentials) = Account :: create (
8085 & NewAccount {
@@ -97,6 +102,7 @@ impl AcmeClient {
97102 dns01_client,
98103 credentials,
99104 max_dns_wait,
105+ dns_txt_ttl,
100106 } )
101107 }
102108
@@ -328,10 +334,13 @@ impl AcmeClient {
328334 . remove_txt_records ( & acme_domain)
329335 . await
330336 . context ( "failed to remove existing dns record" ) ?;
331- debug ! ( "creating TXT record for {acme_domain}" ) ;
337+ debug ! (
338+ "creating TXT record for {acme_domain} with TTL {}s" ,
339+ self . dns_txt_ttl
340+ ) ;
332341 let id = self
333342 . dns01_client
334- . add_txt_record ( & acme_domain, & dns_value)
343+ . add_txt_record ( & acme_domain, & dns_value, self . dns_txt_ttl )
335344 . await
336345 . context ( "failed to create dns record" ) ?;
337346 challenges. push ( Challenge {
0 commit comments