Skip to content

Commit

Permalink
update cloud adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
wilyle committed Nov 6, 2023
1 parent 90a9f4b commit cf19289
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
15 changes: 3 additions & 12 deletions freyja_adapters/cloud/azure_cloud_connector_adapter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ 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,
};

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";
Expand Down Expand Up @@ -85,7 +85,7 @@ impl CloudAdapter for AzureCloudConnectorAdapter {
fn create_new() -> Result<Self, CloudAdapterError> {
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,
Expand Down

0 comments on commit cf19289

Please sign in to comment.