Skip to content

Commit 7351651

Browse files
authored
add vc config dir (#7173)
### Description Add ability to use Vercel's config dir for whatever we need. Closes TURBO-2193
1 parent 363caf8 commit 7351651

File tree

1 file changed

+11
-0
lines changed
  • crates/turborepo-dirs/src

1 file changed

+11
-0
lines changed

crates/turborepo-dirs/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ pub fn config_dir() -> Option<PathBuf> {
1212
}
1313
dirs_config_dir()
1414
}
15+
16+
/// Returns the path to the user's configuration directory. This is a wrapper
17+
/// around `dirs_next::config_dir` that also checks the `VERCEL_CONFIG_DIR_PATH`
18+
/// environment variable. If the environment variable is set, it will return
19+
/// that path instead of `dirs_next::config_dir`.
20+
pub fn vercel_config_dir() -> Option<PathBuf> {
21+
if let Ok(dir) = std::env::var("VERCEL_CONFIG_DIR_PATH") {
22+
return Some(PathBuf::from(dir));
23+
}
24+
dirs_config_dir()
25+
}

0 commit comments

Comments
 (0)