(
config: &CertBotConfig,
dns01_client: Dns01Client,
)
| 56 | } |
| 57 | |
| 58 | async fn create_new_account( |
| 59 | config: &CertBotConfig, |
| 60 | dns01_client: Dns01Client, |
| 61 | ) -> Result<AcmeClient> { |
| 62 | info!("creating new ACME account"); |
| 63 | let client = AcmeClient::new_account( |
| 64 | &config.acme_url, |
| 65 | dns01_client, |
| 66 | config.max_dns_wait, |
| 67 | config.dns_txt_ttl, |
| 68 | ) |
| 69 | .await |
| 70 | .context("failed to create new account")?; |
| 71 | let credentials = client |
| 72 | .dump_credentials() |
| 73 | .context("failed to dump credentials")?; |
| 74 | info!("created new ACME account: {}", client.account_id()); |
| 75 | if config.auto_set_caa { |
| 76 | client |
| 77 | .set_caa_records(&config.cert_subject_alt_names) |
| 78 | .await?; |
| 79 | } |
| 80 | if let Some(credential_dir) = config.credentials_file.parent() { |
| 81 | fs::create_dir_all(credential_dir).context("failed to create credential directory")?; |
| 82 | } |
| 83 | fs::write(&config.credentials_file, credentials).context("failed to write credentials")?; |
| 84 | Ok(client) |
| 85 | } |
| 86 | |
| 87 | impl CertBot { |
| 88 | /// Build a new `CertBot` from a `CertBotConfig`. |
no test coverage detected