summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_mapper/src/az/mapper.rs
diff options
context:
space:
mode:
authorPradeepKiruvale <pradeepkumar.kj@softwareag.com>2022-04-11 15:13:32 +0530
committerGitHub <noreply@github.com>2022-04-11 15:13:32 +0530
commit34ffb846e67b7ccee34348e1d899c12b9bda3756 (patch)
treeb4bab320e381ba2fa482a156f85fe4eab3cdbb1b /crates/core/tedge_mapper/src/az/mapper.rs
parenta718ea43f89d3d7494624da4b226d2eff101acb0 (diff)
Closes #1040 use config-dir feature for initalize and run (#1059)
Diffstat (limited to 'crates/core/tedge_mapper/src/az/mapper.rs')
-rw-r--r--crates/core/tedge_mapper/src/az/mapper.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/core/tedge_mapper/src/az/mapper.rs b/crates/core/tedge_mapper/src/az/mapper.rs
index 0d998eff..2971d2f9 100644
--- a/crates/core/tedge_mapper/src/az/mapper.rs
+++ b/crates/core/tedge_mapper/src/az/mapper.rs
@@ -1,3 +1,5 @@
+use std::path::Path;
+
use crate::{
az::converter::AzureConverter,
core::{component::TEdgeComponent, mapper::create_mapper, size_threshold::SizeThreshold},
@@ -26,10 +28,11 @@ impl TEdgeComponent for AzureMapper {
AZURE_MAPPER_NAME
}
- async fn init(&self) -> Result<(), anyhow::Error> {
+ async fn init(&self, cfg_dir: &Path) -> Result<(), anyhow::Error> {
info!("Initialize tedge mapper az");
+ let config_dir = cfg_dir.display().to_string();
create_directory_with_user_group(
- "/etc/tedge/operations/az",
+ &format!("{config_dir}/operations/az"),
"tedge-mapper",
"tedge-mapper",
0o775,
@@ -39,7 +42,11 @@ impl TEdgeComponent for AzureMapper {
Ok(())
}
- async fn start(&self, tedge_config: TEdgeConfig) -> Result<(), anyhow::Error> {
+ async fn start(
+ &self,
+ tedge_config: TEdgeConfig,
+ _config_dir: &Path,
+ ) -> Result<(), anyhow::Error> {
let add_timestamp = tedge_config.query(AzureMapperTimestamp)?.is_set();
let mqtt_port = tedge_config.query(MqttPortSetting)?.into();
let mqtt_host = tedge_config.query(MqttBindAddressSetting)?.to_string();