-
Notifications
You must be signed in to change notification settings - Fork 9
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
Changes from 1 commit
82cf4a6
58b86ea
ce0a9d5
ccb8e1e
49c4e9d
f69f44d
cce995c
5ded241
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
||
|
@@ -15,8 +16,13 @@ pub struct Settings { | |
|
||
/// Load the settings. | ||
pub fn load_settings() -> Settings { | ||
let config_filename_path = match env::var("IBEJI_HOME") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
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(); | ||
|
||
|
There was a problem hiding this comment.
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".