Skip to content

Commit

Permalink
This commit updates the Config struct to exclude the overwrite_key an…
Browse files Browse the repository at this point in the history
…d force_update fields from serialization. By using the #[serde(skip_serializing)] attribute, these fields will not be included when the Config struct is serialized.
  • Loading branch information
anipaul2 committed May 23, 2023
1 parent 1a89c5d commit ebb86b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions teos/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ pub struct Config {
// Flags
pub debug: bool,
pub deps_debug: bool,
#[serde(skip_serializing)]
pub overwrite_key: bool,
#[serde(skip_serializing)]
pub force_update: bool,

// General
Expand Down
8 changes: 8 additions & 0 deletions teos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ async fn main() {
// Load conf (from file or defaults) and patch it with the command line parameters received (if any)
let mut conf = config::from_file::<Config>(&conf_file_path);
let is_default = conf.is_default();
if conf.overwrite_key {
eprintln!("The 'overwrite_key' parameter cannot be set in the configuration file. Please pass it as a command-line argument if necessary.");
std::process::exit(1);
}
if conf.force_update {
eprintln!("The 'force_update' parameter cannot be set in the configuration file. Please pass it as a command-line argument if necessary.");
std::process::exit(1);
}
conf.patch_with_options(opt);
conf.verify().unwrap_or_else(|e| {
eprintln!("{e}");
Expand Down

0 comments on commit ebb86b6

Please sign in to comment.