Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding IBEJI_HOME env var for loading the invehicle digital twin config file #61

Merged
merged 8 commits into from
Oct 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use std::env;
use config::{Config, File, FileFormat};
use serde_derive::Deserialize;

Expand All @@ -15,8 +16,13 @@ pub struct Settings {

/// Load the settings.
pub fn load_settings() -> Settings {
let config_filename_path = match env::var("IBEJI_HOME") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make IBEJI_HOME a constant in "/core/common/src/utils.rs".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide details on the IBEJI_HOME environment variable in Ibeji's main README.

Ok(s) => format!("{}/{}", s, CONFIG_FILENAME),
_ => CONFIG_FILENAME.to_owned()
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this IBEJI_HOME matching statement to "/core/common/src/utils.rs" in the load_settings<T>(config_filename: &str) method.


let config =
Config::builder().add_source(File::new(CONFIG_FILENAME, FileFormat::Yaml)).build().unwrap();
Config::builder().add_source(File::new(&config_filename_path, FileFormat::Yaml)).build().unwrap();

let settings: Settings = config.try_deserialize().unwrap();

Expand Down