Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Default chroma load config path incorrect #3241

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
2 changes: 1 addition & 1 deletion rust/load/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN --mount=type=cache,sharing=locked,target=/chroma/target/ \

FROM debian:bookworm-slim AS runner
RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /chroma/rust/load/chroma_load.yaml .
COPY --from=builder /chroma/rust/load/chroma_load_config.yaml .

FROM runner AS load_service
COPY --from=load_service_builder /chroma/chroma-load .
Expand Down
File renamed without changes.
15 changes: 4 additions & 11 deletions rust/load/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use figment::providers::{Env, Format, Yaml};
use serde::Deserialize;

const DEFAULT_CONFIG_PATH: &str = "./chroma_config.yaml";
const DEFAULT_CONFIG_PATH: &str = "./chroma_load_config.yaml";

#[derive(Deserialize)]
/// Root config for chroma-load service. Can be part of a larger config file.
Expand All @@ -18,19 +18,12 @@ impl RootConfig {
pub fn load_from_path(path: &str) -> Self {
// Unfortunately, figment doesn't support environment variables with underscores. So we have to map and replace them.
// Excluding our own environment variables, which are prefixed with CHROMA_.
let mut f = figment::Figment::from(Env::prefixed("CHROMA_").map(|k| match k {
k if k == "my_member_id" => k.into(),
k => k.as_str().replace("__", ".").into(),
}));
let mut f = figment::Figment::from(
Env::prefixed("CHROMA_").map(|k| return k.as_str().replace("__", ".").into()),
);
if std::path::Path::new(path).exists() {
f = figment::Figment::from(Yaml::file(path)).merge(f);
}
// Apply defaults - this seems to be the best way to do it.
// https://github.com/SergioBenitez/Figment/issues/77#issuecomment-1642490298
// f = f.join(Serialized::default(
// "worker.num_indexing_threads",
// num_cpus::get(),
// ));
let res = f.extract();
match res {
Ok(config) => config,
Expand Down
Loading