-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
…ig file Signed-off-by: Leonardo Rossetti <[email protected]>
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.
Thanks for submitting a PR @odra. Please take a look at the minor comments below.
@@ -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 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".
let config_filename_path = match env::var("IBEJI_HOME") { | ||
Ok(s) => format!("{}/{}", s, CONFIG_FILENAME), | ||
_ => CONFIG_FILENAME.to_owned() | ||
}; |
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 add this IBEJI_HOME matching statement to "/core/common/src/utils.rs" in the load_settings<T>(config_filename: &str)
method.
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.
Just one comment. Please take a look.
@@ -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 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.
Signed-off-by: Leonardo Rossetti <[email protected]>
Signed-off-by: Leonardo Rossetti <[email protected]>
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.
Comment on your recent changes.
BTW: I kicked off the checks for you. Please take a look at their results.
README.md
Outdated
`./invehicle-digital-twin`<br> | ||
Use the `IBEJI_HOME` env var to load configuration files from a specific directory: <br> |
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 use "variable" rather than "var". This will also fix the associated spelling check error.
@@ -15,10 +15,7 @@ pub struct Settings { | |||
|
|||
/// Load the settings. | |||
pub fn load_settings() -> Settings { | |||
let config = | |||
Config::builder().add_source(File::new(CONFIG_FILENAME, FileFormat::Yaml)).build().unwrap(); | |||
let s = utils::load_settings(CONFIG_FILENAME).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 try to use a meaningful identifier name rather than single character.
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.
We were previously using "settings", rather than "s".
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.
whoops, sorry, forgot to rename it
Signed-off-by: Leonardo Rossetti <[email protected]>
README.md
Outdated
`./invehicle-digital-twin`<br> | ||
Use the `IBEJI_HOME` environment variable to load configuration files from a specific directory: <br> |
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.
Your change here is for one specific sample. You could discuss this environment variable before the details for each sample. Alternatively, you could copy your change into each sample's details.
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.
I think a high level directive makes more sense and scales better. Let me move it upwards.
Signed-off-by: Leonardo Rossetti <[email protected]>
@odra - Please address the issues raised by the checks. You can ignore the "Alex Recommends - language" checks and the "Lint and Check Markdown" checks, as these are caused by known issues. The other checks must be resolved. |
@odra - Please fix the issues that the "Rust CI / static_code_analysis" check detected. Thanks. |
Signed-off-by: Leonardo Rossetti <[email protected]>
Signed-off-by: Leonardo Rossetti <[email protected]>
I've sent an update. Would you like for me to squash all my commits into a single one? |
Please do this when you merge in your changes. I'll kick off the checks again to see if everything looks clean. |
@odra - The "Rust CI / static_code_analysis" check is still failing. You need to run "cargo fmt" on your PR branch and push the changes. |
Signed-off-by: Leonardo Rossetti <[email protected]>
Just sent a fix :-) |
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.
Approved
@odra - Since you do not have committer privileges, I squashed and merged your changes for you. |
No worries, thanks for the review :) |
…ig file (eclipse-ibeji#61) * adding IBEJI_HOME env var for loading the invehicle digital twin config file Signed-off-by: Leonardo Rossetti <[email protected]> * use common::utils to load config file Signed-off-by: Leonardo Rossetti <[email protected]> * IBEJI_HOME env var docs Signed-off-by: Leonardo Rossetti <[email protected]> * fix variable name and readme typo Signed-off-by: Leonardo Rossetti <[email protected]> * move environment variable instructions Signed-off-by: Leonardo Rossetti <[email protected]> * adding code block language Signed-off-by: Leonardo Rossetti <[email protected]> * remove unecessary let Signed-off-by: Leonardo Rossetti <[email protected]> * static analysis fix Signed-off-by: Leonardo Rossetti <[email protected]> --------- Signed-off-by: Leonardo Rossetti <[email protected]>
Changes
invehicle-digital-twin
binaryVerification
Running the binary with and without the env var should return the correct error path: