added some more error messages
Dieser Commit ist enthalten in:
Ursprung
11f7df2116
Commit
01a4a64ae6
2 geänderte Dateien mit 28 neuen und 5 gelöschten Zeilen
21
src/main.rs
21
src/main.rs
|
@ -114,9 +114,16 @@ async fn racme(flags: Arguments) -> Result<(), Error> {
|
||||||
ReadDirStream::new(rd)
|
ReadDirStream::new(rd)
|
||||||
};
|
};
|
||||||
let mut siteconfigs = Vec::new();
|
let mut siteconfigs = Vec::new();
|
||||||
for file in files.filter(Result::is_ok).map(|file| file.unwrap().path()).collect::<Vec<PathBuf>>().await {
|
for filename in files.filter(Result::is_ok).map(|file| file.unwrap().path()).collect::<Vec<PathBuf>>().await {
|
||||||
let mut site = SiteConfig::from_file(FILE_MODE.open(file.clone()).await.unwrap()).await;
|
let file = match FILE_MODE.open(filename.clone()).await {
|
||||||
site.name = file.file_stem().unwrap().to_str().unwrap().to_string();
|
Ok(file) => file,
|
||||||
|
Err(error) => {
|
||||||
|
warn!("Failed to read the configfile {}: {}", filename.display(), error);
|
||||||
|
continue;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let mut site = SiteConfig::from_file(file).await;
|
||||||
|
site.name = filename.file_stem().unwrap().to_string_lossy().to_string();
|
||||||
siteconfigs.push(site);
|
siteconfigs.push(site);
|
||||||
}
|
}
|
||||||
let used = siteconfigs.iter().map(|s| s.ca.clone()).collect::<HashSet<_>>();
|
let used = siteconfigs.iter().map(|s| s.ca.clone()).collect::<HashSet<_>>();
|
||||||
|
@ -174,7 +181,13 @@ async fn racme(flags: Arguments) -> Result<(), Error> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log_init();
|
log_init();
|
||||||
let runtime = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
|
let runtime = match tokio::runtime::Builder::new_current_thread().enable_all().build() {
|
||||||
|
Ok(runtime) => runtime,
|
||||||
|
Err(error) => {
|
||||||
|
error!("Could not initialize Tokio runtime: {error}");
|
||||||
|
exit(2)
|
||||||
|
},
|
||||||
|
};
|
||||||
let result = runtime.block_on(racme(Arguments::parse()));
|
let result = runtime.block_on(racme(Arguments::parse()));
|
||||||
runtime.shutdown_timeout(Duration::from_secs(1));
|
runtime.shutdown_timeout(Duration::from_secs(1));
|
||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
|
|
|
@ -311,7 +311,17 @@ pub async fn site(args: ProcessorArgs<'_>) {
|
||||||
error!("Failed to complete the order: check the logs for more information");
|
error!("Failed to complete the order: check the logs for more information");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let certs = order.certificate().await.unwrap().unwrap();
|
let certs = match order.certificate().await {
|
||||||
|
Err(error) => {
|
||||||
|
error!("Failed to retrieve the certificates: {error}");
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
Ok(None) => {
|
||||||
|
error!("The list of Certificate is Empty");
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
Ok(Some(certs)) => certs,
|
||||||
|
};
|
||||||
debug!("Received {} certificates.", certs.len());
|
debug!("Received {} certificates.", certs.len());
|
||||||
let mut pubkey_file = match_error!(FILE_MODE_WRITE.open(pubkey_filename).await=>Err(error)-> "Failed to open the file for the publickey: {error}");
|
let mut pubkey_file = match_error!(FILE_MODE_WRITE.open(pubkey_filename).await=>Err(error)-> "Failed to open the file for the publickey: {error}");
|
||||||
match_error!(pubkey_file.write_all(&certs[0].to_pem().unwrap()).await=>Err(error)-> "Failed to write the publickey: {error}");
|
match_error!(pubkey_file.write_all(&certs[0].to_pem().unwrap()).await=>Err(error)-> "Failed to write the publickey: {error}");
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren