From 62d0da3923a7f9dce1da21098f1891c8845b5b9b Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Wed, 8 Apr 2026 18:29:48 -0300 Subject: [PATCH] Add local-files feature to disable local storage scanning - Without local-files feature: only MinIO/Drive is used as bot source - With local-files feature: scans /opt/gbo/data for bots (default behavior) - Bucket filtering (gbo-*) only active when local-files is NOT enabled - LocalFileMonitor and ConfigWatcher only start with local-files feature --- Cargo.toml | 2 ++ src/drive/mod.rs | 4 +++- src/main_module/bootstrap.rs | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2df1f1c8..1597b752 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,8 @@ external_sync = ["automation", "drive", "cache"] scripting = ["dep:rhai"] automation = ["scripting", "dep:cron"] drive = ["dep:aws-config", "dep:aws-sdk-s3", "dep:aws-smithy-async", "dep:pdf-extract"] +# local-files: Enables local file monitoring (scans /opt/gbo/data for bots) +# Without this feature, only MinIO/Drive is used as bot source local-files = ["dep:notify"] cache = ["dep:redis"] directory = ["rbac"] diff --git a/src/drive/mod.rs b/src/drive/mod.rs index d101c1c5..2b186bf9 100644 --- a/src/drive/mod.rs +++ b/src/drive/mod.rs @@ -345,7 +345,9 @@ pub async fn list_buckets( .filter_map(|b| { b.name().map(|name| { let name_str = name.to_string(); - // Only include buckets that start with "gbo-" + // Only include buckets that start with "gbo-" when local-files is NOT enabled + // This ensures only MinIO-sourced bots are used in cloud/gateway mode + #[cfg(not(feature = "local-files"))] if !name_str.starts_with("gbo-") { return None; } diff --git a/src/main_module/bootstrap.rs b/src/main_module/bootstrap.rs index d8ff1c98..d9b22162 100644 --- a/src/main_module/bootstrap.rs +++ b/src/main_module/bootstrap.rs @@ -893,9 +893,12 @@ pub async fn start_background_services( #[cfg(feature = "drive")] start_drive_monitors(app_state.clone(), pool).await; + // Local file monitoring only enabled when local-files feature is present #[cfg(feature = "local-files")] start_local_file_monitor(app_state.clone()).await; + // ConfigWatcher only enabled when local-files feature is present + #[cfg(feature = "local-files")] start_config_watcher(app_state.clone()).await; }