config: acme: fall-back to the "default" account
syncs behavior with both, the displayed state in the PBS web-interface, and the behavior of PVE/PMG. Without this a standard setup would result in a Error like: > TASK ERROR: no acme client configured which was pretty confusing, as the actual error was something else (no account configured), and the web-interface showed "default" as selected account, so a user had no idea what actually was wrong and how to fix it. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
fca1cef29f
commit
38b4f9b534
|
@ -2,7 +2,7 @@ use std::collections::HashSet;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::{bail, format_err, Error};
|
use anyhow::{bail, Error};
|
||||||
use nix::sys::stat::Mode;
|
use nix::sys::stat::Mode;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -138,13 +138,12 @@ impl NodeConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn acme_client(&self) -> Result<AcmeClient, Error> {
|
pub async fn acme_client(&self) -> Result<AcmeClient, Error> {
|
||||||
AcmeClient::load(
|
let account = if let Some(cfg) = self.acme_config().transpose()? {
|
||||||
&self
|
cfg.account
|
||||||
.acme_config()
|
} else {
|
||||||
.ok_or_else(|| format_err!("no acme client configured"))??
|
AcmeAccountName::from_string("default".to_string())? // should really not happen
|
||||||
.account,
|
};
|
||||||
)
|
AcmeClient::load(&account).await
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn acme_domains(&self) -> AcmeDomainIter {
|
pub fn acme_domains(&self) -> AcmeDomainIter {
|
||||||
|
|
Loading…
Reference in New Issue