1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Configuration management for Maproom hybrid search.
//!
//! This module provides a comprehensive configuration system with:
//! - YAML configuration file loading
//! - Environment variable overrides
//! - Hot reload support for fusion weights
//! - Feature flags for toggling search capabilities
//! - Thread-safe configuration access
//!
//! # Configuration Loading
//!
//! Configuration is loaded in the following order (later sources override earlier ones):
//! 1. Default configuration file (`config/maproom-search.yml`)
//! 2. Environment-specific overrides via `MAPROOM_SEARCH_*` variables
//!
//! # Environment Variables
//!
//! Any configuration value can be overridden using environment variables with the pattern:
//! ```text
//! MAPROOM_SEARCH_<SECTION>_<KEY>=<value>
//! ```
//!
//! Examples:
//! - `MAPROOM_SEARCH_FUSION_WEIGHTS_FTS=0.5`
//! - `MAPROOM_SEARCH_PERFORMANCE_TIMEOUT_MS=200`
//! - `MAPROOM_SEARCH_FEATURE_FLAGS_ENABLE_VECTOR_SEARCH=false`
//!
//! # Hot Reload
//!
//! Fusion weights can be updated at runtime without restarting the service when
//! `feature_flags.enable_hot_reload=true`. Changes to the configuration file are
//! detected and applied automatically after validation.
//!
//! # Examples
//!
//! ## Load Configuration
//!
//! ```no_run
//! use maproom::config::SearchConfig;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! // Load from default path (config/maproom-search.yml)
//! let config = SearchConfig::load_default().await?;
//!
//! println!("Fusion method: {:?}", config.fusion.method);
//! println!("FTS weight: {}", config.fusion.weights.fts);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Access Configuration with Thread Safety
//!
//! ```no_run
//! use maproom::config::SearchConfig;
//! use std::sync::Arc;
//! use tokio::sync::RwLock;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let config = Arc::new(RwLock::new(SearchConfig::load_default().await?));
//!
//! // Read configuration
//! {
//! let cfg = config.read().await;
//! println!("Vector search enabled: {}", cfg.feature_flags.enable_vector_search);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Hot Reload
//!
//! ```no_run
//! use maproom::config::{SearchConfig, ConfigReloader};
//! use std::sync::Arc;
//! use tokio::sync::RwLock;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let config = Arc::new(RwLock::new(SearchConfig::load_default().await?));
//!
//! // Start hot reload watcher
//! let mut reloader = ConfigReloader::new(config.clone(), "config/maproom-search.yml")?;
//!
//! // Spawn watcher in background
//! tokio::spawn(async move {
//! if let Err(e) = reloader.watch().await {
//! eprintln!("Hot reload error: {}", e);
//! }
//! });
//!
//! // Configuration updates automatically as file changes
//! tokio::time::sleep(tokio::time::Duration::from_secs(60)).await;
//!
//! Ok(())
//! }
//! ```
// Re-export cache configuration from cache module
pub use crate;
pub use FeatureFlags;
pub use ;
pub use ;
pub use ;