Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions crates/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repository.workspace = true
workspace = true

[dependencies]
serde_ignored = "0.1"
foundry-block-explorers = { workspace = true, features = ["foundry-compilers"] }
foundry-compilers = { workspace = true, features = ["svm-solc"] }

Expand Down
19 changes: 19 additions & 0 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ use std::{
str::FromStr,
};

use tracing::warn;

mod macros;

pub mod utils;
Expand Down Expand Up @@ -641,6 +643,23 @@ impl Config {
}

fn from_figment(figment: Figment) -> Result<Self, ExtractConfigError> {
let file_path = Path::new("foundry.toml");
if let Ok(raw) = fs::read_to_string(&file_path) {
let deserializer = toml::Deserializer::new(&raw);
let mut ignored = Vec::new();
let _: Result<Self, _> = serde_ignored::deserialize(deserializer, |path| {
ignored.push(path.to_string());
});

if !ignored.is_empty() {
warn!(
"Found unknown config keys in {}: {}",
file_path.display(),
ignored.join(", ")
);
}
}

let mut config = figment.extract::<Self>().map_err(ExtractConfigError::new)?;
config.profile = figment.profile().clone();

Expand Down
Loading