diff --git a/freyja_adapters/cloud/azure_cloud_connector_adapter/Cargo.toml b/freyja_adapters/cloud/azure_cloud_connector_adapter/Cargo.toml index bb70667..e005e47 100644 --- a/freyja_adapters/cloud/azure_cloud_connector_adapter/Cargo.toml +++ b/freyja_adapters/cloud/azure_cloud_connector_adapter/Cargo.toml @@ -11,6 +11,7 @@ license = "MIT" [dependencies] async-trait = { workspace = true } azure-cloud-connector-proto = { workspace = true } +freyja-build-common = { workspace = true } freyja-common = { workspace = true } freyja-contracts = { workspace = true } futures = { workspace = true } diff --git a/freyja_adapters/cloud/azure_cloud_connector_adapter/build.rs b/freyja_adapters/cloud/azure_cloud_connector_adapter/build.rs index 3ee420a..47b4b6f 100644 --- a/freyja_adapters/cloud/azure_cloud_connector_adapter/build.rs +++ b/freyja_adapters/cloud/azure_cloud_connector_adapter/build.rs @@ -2,19 +2,10 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use std::env; +use freyja_build_common::copy_config; -use freyja_build_common::copy_to_build_out_dir; - -const RES_DIR_NAME: &str = "res"; -const DEFAULT_CONFIG_FILE: &str = "azure_cloud_connector_adapter_config.default.json"; +const CONFIG_FILE_STEM: &str = "azure_cloud_connector_adapter_config"; fn main() { - // Current directory of the build script is the package's root directory - let config_path = env::current_dir() - .unwrap() - .join(RES_DIR_NAME) - .join(DEFAULT_CONFIG_FILE); - - copy_to_build_out_dir(config_path, DEFAULT_CONFIG_FILE); + copy_config(CONFIG_FILE_STEM); } diff --git a/freyja_adapters/cloud/azure_cloud_connector_adapter/src/azure_cloud_connector_adapter.rs b/freyja_adapters/cloud/azure_cloud_connector_adapter/src/azure_cloud_connector_adapter.rs index 976a0a6..6f29f55 100644 --- a/freyja_adapters/cloud/azure_cloud_connector_adapter/src/azure_cloud_connector_adapter.rs +++ b/freyja_adapters/cloud/azure_cloud_connector_adapter/src/azure_cloud_connector_adapter.rs @@ -12,6 +12,7 @@ use log::debug; use serde::{Deserialize, Serialize}; use tonic::transport::Channel; +use freyja_build_common::config_file_stem; use freyja_common::{config_utils, out_dir, retry_utils::execute_with_retry}; use freyja_contracts::cloud_adapter::{ CloudAdapter, CloudAdapterError, CloudMessageRequest, CloudMessageResponse, @@ -19,7 +20,6 @@ use freyja_contracts::cloud_adapter::{ use crate::config::Config; -const CONFIG_FILE_STEM: &str = "azure_cloud_connector_adapter_config"; const MODEL_ID_KEY: &str = "model_id"; const INSTANCE_ID_KEY: &str = "instance_id"; const INSTANCE_PROPERTY_PATH_KEY: &str = "instance_property_path"; @@ -85,7 +85,7 @@ impl CloudAdapter for AzureCloudConnectorAdapter { fn create_new() -> Result { let cloud_connector_client = futures::executor::block_on(async { let config: Config = config_utils::read_from_files( - CONFIG_FILE_STEM, + config_file_stem!(), config_utils::JSON_EXT, out_dir!(), CloudAdapterError::io,