Skip to content

Commit

Permalink
Don't allow cache config to be sourced from config file. Also include…
Browse files Browse the repository at this point in the history
… env var mapping
  • Loading branch information
NicholasLYang committed Oct 31, 2024
1 parent 1470a4d commit 9c99caf
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 13 deletions.
3 changes: 0 additions & 3 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions crates/turborepo-cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ workspace = true

[dependencies]
base64 = "0.21.0"
biome_deserialize = { workspace = true }
biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
bytes.workspace = true
camino = { workspace = true }
futures = { workspace = true }
Expand Down
7 changes: 3 additions & 4 deletions crates/turborepo-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod upload_progress;
use std::{backtrace, backtrace::Backtrace};

pub use async_cache::AsyncCache;
use biome_deserialize_macros::Deserializable;
use camino::Utf8PathBuf;
use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand Down Expand Up @@ -109,7 +108,7 @@ pub struct CacheHitMetadata {
pub time_saved: u64,
}

#[derive(Serialize, Deserialize, Deserializable, Debug, PartialEq, Eq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct CacheActions {
pub read: bool,
pub write: bool,
Expand All @@ -121,7 +120,7 @@ impl CacheActions {
}
}

#[derive(Serialize, Deserialize, Deserializable, Debug, PartialEq, Eq, Clone, Copy, Default)]
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
pub struct CacheConfig {
pub local: CacheActions,
pub remote: CacheActions,
Expand All @@ -142,7 +141,7 @@ impl Default for CacheActions {
}
}

#[derive(Clone, Debug, Default, Serialize)]
#[derive(Clone, Debug, Default)]
pub struct CacheOpts {
pub cache_dir: Utf8PathBuf,
pub cache: CacheConfig,
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-lib/src/config/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const TURBO_MAPPING: &[(&str, &str)] = [
("turbo_remote_cache_read_only", "remote_cache_read_only"),
("turbo_run_summary", "run_summary"),
("turbo_allow_no_turbo_json", "allow_no_turbo_json"),
("turbo_cache", "cache"),
]
.as_slice();

Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-lib/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ pub struct ConfigurationOptions {
pub(crate) root_turbo_json_path: Option<AbsoluteSystemPathBuf>,
pub(crate) force: Option<bool>,
pub(crate) log_order: Option<LogOrder>,
#[serde(skip)]
pub(crate) cache: Option<CacheConfig>,
pub(crate) remote_only: Option<bool>,
pub(crate) remote_cache_read_only: Option<bool>,
Expand Down
3 changes: 0 additions & 3 deletions crates/turborepo-lib/src/turbo_json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ mod loader;
pub mod parser;

pub use loader::TurboJsonLoader;
use turborepo_cache::CacheConfig;

#[derive(Serialize, Deserialize, Debug, Default, PartialEq, Clone, Deserializable)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -140,8 +139,6 @@ pub struct RawTurboJson {
pub env_mode: Option<EnvMode>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cache_dir: Option<Spanned<UnescapedString>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cache: Option<CacheConfig>,

#[deserializable(rename = "//")]
#[serde(skip)]
Expand Down

0 comments on commit 9c99caf

Please # to comment.