signstar_configure/host/
all_backends.rs1use log::info;
4
5use crate::{ConfigurationResult, Error, HostConfiguration};
6
7impl<'config> HostConfiguration<'config> {
8 pub fn sync(&self) -> Result<ConfigurationResult, Error> {
17 info!("Sync the Signstar host with its configuration.");
18
19 let nethsm_config_result = self.sync_nethsm()?;
20 let yubihsm_config_result = self.sync_yubihsm2()?;
21
22 if matches!(
23 nethsm_config_result,
24 ConfigurationResult::MissingConfigurationForBackend
25 ) && matches!(
26 yubihsm_config_result,
27 ConfigurationResult::MissingConfigurationForBackend
28 ) {
29 return Ok(ConfigurationResult::MissingConfigurationForBackend);
30 }
31
32 if !matches!(
33 nethsm_config_result,
34 ConfigurationResult::SyncSucceeded
35 | ConfigurationResult::MissingConfigurationForBackend
36 ) {
37 return Ok(nethsm_config_result);
38 }
39
40 if !matches!(
41 yubihsm_config_result,
42 ConfigurationResult::SyncSucceeded
43 | ConfigurationResult::MissingConfigurationForBackend
44 ) {
45 return Ok(yubihsm_config_result);
46 }
47
48 Ok(ConfigurationResult::SyncSucceeded)
49 }
50}