Skip to content

Commit

Permalink
feat: log the loaded configuration when the node starts running
Browse files Browse the repository at this point in the history
commit-id:17e3b0e2
  • Loading branch information
nadin-Starkware committed Dec 19, 2024
1 parent d8114ea commit 01522e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/papyrus_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ serde_json = { workspace = true, features = ["arbitrary_precision"] }
strum_macros.workspace = true
thiserror.workspace = true
validator = { workspace = true, features = ["derive"] }
tracing.workspace = true

[dev-dependencies]
assert_matches.workspace = true
Expand Down
8 changes: 7 additions & 1 deletion crates/papyrus_config/src/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use clap::Command;
use command::{get_command_matches, update_config_map_by_command_args};
use itertools::any;
use serde::Deserialize;
use serde_json::{json, Map, Value};
use serde_json::{json, to_string_pretty, Map, Value};
use tracing::info;

use crate::validators::validate_path_exists;
use crate::{
Expand All @@ -33,6 +34,11 @@ use crate::{
pub fn load<T: for<'a> Deserialize<'a>>(
config_map: &BTreeMap<ParamPath, Value>,
) -> Result<T, ConfigError> {
if let Ok(pretty_config) = to_string_pretty(&config_map) {
info!("config_map: {}", pretty_config);
} else {
info!("Failed to pretty-print config_map");
}
let mut nested_map = json!({});
for (param_path, value) in config_map {
let mut entry = &mut nested_map;
Expand Down

0 comments on commit 01522e6

Please sign in to comment.