diff --git a/Cargo.lock b/Cargo.lock index 5ea88263d..bca499854 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2152,7 +2152,7 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2405,7 +2405,7 @@ dependencies = [ "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "text_io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2704,7 +2704,7 @@ dependencies = [ "checksum tokio-threadpool 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2bd2c6a3885302581f4401c82af70d792bb9df1700e7437b0aeb4ada94d5388c" "checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -"checksum toml 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7aabe75941d914b72bf3e5d3932ed92ce0664d49d8432305a8b547c37227724" +"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf" "checksum trackable 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "11475c3c53b075360eac9794965822cb053996046545f91cf61d90e00b72efa5" "checksum trackable_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0f4062d54dd240bde289717d6b4af18048c3dd552f01a0fd93824f5fc4d2d084" "checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41" diff --git a/Cargo.toml b/Cargo.toml index 677b178e2..a10840b8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ openssl = { version = '0.10.11', optional = true } reqwest = "0.9.18" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.39" -toml = "0.5.0" +toml = "0.5.5" uuid = "0.7" which = "2.0.1" rand = "0.6.5" diff --git a/src/settings/toml/manifest.rs b/src/settings/toml/manifest.rs index 5fa35a1d9..6edf473ce 100644 --- a/src/settings/toml/manifest.rs +++ b/src/settings/toml/manifest.rs @@ -36,6 +36,8 @@ pub struct Manifest { pub zone_id: Option, pub webpack_config: Option, pub private: Option, + // TODO: maybe one day, serde toml support will allow us to serialize sites + // as a TOML inline table (this would prevent confusion with environments too!) pub site: Option, #[serde(rename = "kv-namespaces")] pub kv_namespaces: Option>, @@ -46,7 +48,16 @@ impl Manifest { pub fn new(config_path: &Path) -> Result { let config = read_config(config_path)?; - let manifest: Manifest = config.try_into()?; + let manifest: Manifest = match config.try_into() { + Ok(m) => m, + Err(e) => { + if e.to_string().contains("unknown field `kv-namespaces`") { + failure::bail!("kv-namespaces should not live under the [site] table in wrangler.toml; please move it above [site].") + } else { + failure::bail!(e) + } + } + }; check_for_duplicate_names(&manifest)?; diff --git a/src/settings/toml/site.rs b/src/settings/toml/site.rs index 8d0c901be..60de86925 100644 --- a/src/settings/toml/site.rs +++ b/src/settings/toml/site.rs @@ -9,6 +9,7 @@ use crate::commands::generate::run_generate; const SITE_ENTRY_POINT: &str = "workers-site"; #[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(deny_unknown_fields)] pub struct Site { pub bucket: PathBuf, #[serde(rename = "entry-point")]