Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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 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 engine/packages/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ serde_json.workspace = true
serde.workspace = true
url.workspace = true
uuid.workspace = true
tracing.workspace = true
11 changes: 10 additions & 1 deletion engine/packages/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ fn add_source<P: AsRef<Path>>(
let path = path.as_ref();

if !path.exists() {
tracing::debug!(path=%path.display(), "ignoring non-existent config path");

// Silently ignore non-existent paths
return Ok(settings);
}

if path.is_dir() {
tracing::debug!(path=%path.display(), "loading config from directory");

for entry in std::fs::read_dir(path)? {
let entry = entry?;
let path = entry.path();
Expand All @@ -96,9 +100,14 @@ fn add_source<P: AsRef<Path>>(
}
}
} else if path.is_file() {
tracing::debug!(path=%path.display(), "loading config from file");

settings = add_file_source(settings, path)?;
} else {
bail!("Invalid path: {}", path.display());
bail!(
"Invalid Rivet config path: {}. Ensure the path exists and is either a directory with config files or a specific config file.",
path.display()
);
}

Ok(settings)
Expand Down
Loading