From bceb1e6ebfc503d3e2af2b1a0051800936ed4b36 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Thu, 7 Aug 2025 05:17:21 -0400 Subject: [PATCH] dev-23 use indexmap --- Cargo.lock | 33 ++++++++++++++-------------- Cargo.toml | 2 +- bin/core/aio.Dockerfile | 6 ++--- bin/core/debian-deps.sh | 2 +- bin/core/multi-arch.Dockerfile | 6 ++--- bin/core/single-arch.Dockerfile | 6 ++--- bin/periphery/aio.Dockerfile | 2 +- bin/periphery/debian-deps.sh | 2 +- bin/periphery/multi-arch.Dockerfile | 2 +- bin/periphery/single-arch.Dockerfile | 2 +- lib/config/Cargo.toml | 1 + lib/config/src/lib.rs | 11 +++++++--- 12 files changed, 41 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8473ce74c..1bd7f1bef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -904,7 +904,7 @@ dependencies = [ [[package]] name = "cache" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "tokio", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "command" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "komodo_client", "run_command", @@ -1069,9 +1069,10 @@ dependencies = [ [[package]] name = "config" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "colored", + "indexmap 2.10.0", "serde", "serde_json", "thiserror 2.0.12", @@ -1284,7 +1285,7 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "database" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "async-compression", @@ -1582,7 +1583,7 @@ dependencies = [ [[package]] name = "environment" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "formatting", @@ -1592,7 +1593,7 @@ dependencies = [ [[package]] name = "environment_file" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "thiserror 2.0.12", ] @@ -1682,7 +1683,7 @@ dependencies = [ [[package]] name = "formatting" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "serror", ] @@ -1844,7 +1845,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "cache", @@ -2450,7 +2451,7 @@ dependencies = [ [[package]] name = "interpolate" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "komodo_client", @@ -2581,7 +2582,7 @@ dependencies = [ [[package]] name = "komodo_cli" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "clap", @@ -2603,7 +2604,7 @@ dependencies = [ [[package]] name = "komodo_client" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "async_timing_util", @@ -2636,7 +2637,7 @@ dependencies = [ [[package]] name = "komodo_core" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "arc-swap", @@ -2705,7 +2706,7 @@ dependencies = [ [[package]] name = "komodo_periphery" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "arc-swap", @@ -2825,7 +2826,7 @@ dependencies = [ [[package]] name = "logger" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "komodo_client", @@ -3567,7 +3568,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "periphery_client" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "komodo_client", @@ -4098,7 +4099,7 @@ dependencies = [ [[package]] name = "response" -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index ccc1b8b19..5e84de406 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ ] [workspace.package] -version = "1.18.5-dev-22" +version = "1.18.5-dev-23" edition = "2024" authors = ["mbecker20 "] license = "GPL-3.0-or-later" diff --git a/bin/core/aio.Dockerfile b/bin/core/aio.Dockerfile index 5f8a2b82a..081917964 100644 --- a/bin/core/aio.Dockerfile +++ b/bin/core/aio.Dockerfile @@ -26,7 +26,7 @@ RUN cd frontend && yarn link komodo_client && yarn && yarn build # Final Image FROM debian:bullseye-slim -COPY ./bin/core/starship.toml /config/starship.toml +COPY ./bin/core/starship.toml /starship.toml COPY ./bin/core/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh @@ -49,8 +49,8 @@ RUN mkdir /action-cache && \ # Hint at the port EXPOSE 9120 -ENV KOMODO_CLI_CONFIG_PATHS="/config" -ENV KOMODO_CLI_CONFIG_KEYWORDS="config.toml,*komodo.cli*.toml" +# This ensures any `komodo.cli.toml` takes precedence over the Core `/config/config.toml` +ENV KOMODO_CLI_CONFIG_PATHS="/config/config.toml,/config" CMD [ "core" ] diff --git a/bin/core/debian-deps.sh b/bin/core/debian-deps.sh index 0e4007777..25f587b0a 100644 --- a/bin/core/debian-deps.sh +++ b/bin/core/debian-deps.sh @@ -9,6 +9,6 @@ rm -rf /var/lib/apt/lists/* # Starship prompt curl -sS https://starship.rs/install.sh | sh -s -- --yes --bin-dir /usr/local/bin -echo 'export STARSHIP_CONFIG=/config/starship.toml' >> /root/.bashrc +echo 'export STARSHIP_CONFIG=/starship.toml' >> /root/.bashrc echo 'eval "$(starship init bash)"' >> /root/.bashrc diff --git a/bin/core/multi-arch.Dockerfile b/bin/core/multi-arch.Dockerfile index 4db764368..6081072fa 100644 --- a/bin/core/multi-arch.Dockerfile +++ b/bin/core/multi-arch.Dockerfile @@ -15,7 +15,7 @@ FROM ${FRONTEND_IMAGE} AS frontend # Final Image FROM debian:bullseye-slim -COPY ./bin/core/starship.toml /config/starship.toml +COPY ./bin/core/starship.toml /starship.toml COPY ./bin/core/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh @@ -47,8 +47,8 @@ RUN mkdir /action-cache && \ # Hint at the port EXPOSE 9120 -ENV KOMODO_CLI_CONFIG_PATHS="/config" -ENV KOMODO_CLI_CONFIG_KEYWORDS="config.toml,*komodo.cli*.toml" +# This ensures any `komodo.cli.toml` takes precedence over the Core `/config/config.toml` +ENV KOMODO_CLI_CONFIG_PATHS="/config/config.toml,/config" CMD [ "core" ] diff --git a/bin/core/single-arch.Dockerfile b/bin/core/single-arch.Dockerfile index 5a942d1aa..39a78da94 100644 --- a/bin/core/single-arch.Dockerfile +++ b/bin/core/single-arch.Dockerfile @@ -16,7 +16,7 @@ RUN cd frontend && yarn link komodo_client && yarn && yarn build FROM debian:bullseye-slim -COPY ./bin/core/starship.toml /config/starship.toml +COPY ./bin/core/starship.toml /starship.toml COPY ./bin/core/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh @@ -36,8 +36,8 @@ RUN mkdir /action-cache && \ # Hint at the port EXPOSE 9120 -ENV KOMODO_CLI_CONFIG_PATHS="/config" -ENV KOMODO_CLI_CONFIG_KEYWORDS="config.toml,*komodo.cli*.toml" +# This ensures any `komodo.cli.toml` takes precedence over the Core `/config/config.toml` +ENV KOMODO_CLI_CONFIG_PATHS="/config/config.toml,/config" CMD [ "core" ] diff --git a/bin/periphery/aio.Dockerfile b/bin/periphery/aio.Dockerfile index cd96ee2df..c2cfe0cee 100644 --- a/bin/periphery/aio.Dockerfile +++ b/bin/periphery/aio.Dockerfile @@ -15,7 +15,7 @@ RUN cargo build -p komodo_periphery --release # Final Image FROM debian:bullseye-slim -COPY ./bin/periphery/starship.toml /config/starship.toml +COPY ./bin/periphery/starship.toml /starship.toml COPY ./bin/periphery/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh diff --git a/bin/periphery/debian-deps.sh b/bin/periphery/debian-deps.sh index d8812cf60..363a5f53c 100644 --- a/bin/periphery/debian-deps.sh +++ b/bin/periphery/debian-deps.sh @@ -23,6 +23,6 @@ rm -rf /var/lib/apt/lists/* # Starship prompt curl -sS https://starship.rs/install.sh | sh -s -- --yes --bin-dir /usr/local/bin -echo 'export STARSHIP_CONFIG=/config/starship.toml' >> /root/.bashrc +echo 'export STARSHIP_CONFIG=/starship.toml' >> /root/.bashrc echo 'eval "$(starship init bash)"' >> /root/.bashrc diff --git a/bin/periphery/multi-arch.Dockerfile b/bin/periphery/multi-arch.Dockerfile index facce191b..3751fafe9 100644 --- a/bin/periphery/multi-arch.Dockerfile +++ b/bin/periphery/multi-arch.Dockerfile @@ -12,7 +12,7 @@ FROM ${AARCH64_BINARIES} AS aarch64 FROM debian:bullseye-slim -COPY ./bin/periphery/starship.toml /config/starship.toml +COPY ./bin/periphery/starship.toml /starship.toml COPY ./bin/periphery/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh diff --git a/bin/periphery/single-arch.Dockerfile b/bin/periphery/single-arch.Dockerfile index ab9ba4bb8..586939ca0 100644 --- a/bin/periphery/single-arch.Dockerfile +++ b/bin/periphery/single-arch.Dockerfile @@ -8,7 +8,7 @@ FROM ${BINARIES_IMAGE} AS binaries FROM debian:bullseye-slim -COPY ./bin/periphery/starship.toml /config/starship.toml +COPY ./bin/periphery/starship.toml /starship.toml COPY ./bin/periphery/debian-deps.sh . RUN sh ./debian-deps.sh && rm ./debian-deps.sh diff --git a/lib/config/Cargo.toml b/lib/config/Cargo.toml index bcac58166..fb7b6ff8d 100644 --- a/lib/config/Cargo.toml +++ b/lib/config/Cargo.toml @@ -10,6 +10,7 @@ homepage.workspace = true [dependencies] serde_json.workspace = true thiserror.workspace = true +indexmap.workspace = true wildcard.workspace = true colored.workspace = true serde.workspace = true diff --git a/lib/config/src/lib.rs b/lib/config/src/lib.rs index ff438c4ea..98845216a 100644 --- a/lib/config/src/lib.rs +++ b/lib/config/src/lib.rs @@ -6,6 +6,7 @@ use std::{ }; use colored::Colorize; +use indexmap::IndexSet; use serde::de::DeserializeOwned; mod error; @@ -36,7 +37,7 @@ pub fn parse_config_paths( } } } - let mut all_files = Vec::new(); + let mut all_files = IndexSet::new(); for &path in paths { let Ok(metadata) = std::fs::metadata(path) else { continue; @@ -64,7 +65,7 @@ pub fn parse_config_paths( files.sort(); all_files.extend(files); } else if metadata.is_file() { - all_files.push(path.to_path_buf()); + all_files.insert(path.to_path_buf()); } } println!( @@ -72,7 +73,11 @@ pub fn parse_config_paths( "INFO".green(), "Found Files".dimmed() ); - parse_config_files(&all_files, merge_nested, extend_array) + parse_config_files( + &all_files.into_iter().collect::>(), + merge_nested, + extend_array, + ) } fn ignore_dir(path: &Path, ignores: &HashSet) -> bool {