pub struct Config {
pub modules_path: Option<PathBuf>,
pub max_call_depth: u32,
pub max_module_repeat: u32,
pub default_timeout_ms: u64,
pub global_timeout_ms: u64,
pub enable_tracing: bool,
pub enable_metrics: bool,
pub settings: HashMap<String, Value>,
pub yaml_path: Option<PathBuf>,
pub mode: ConfigMode,
}Fields§
§modules_path: Option<PathBuf>§max_call_depth: u32§max_module_repeat: u32§default_timeout_ms: u64§global_timeout_ms: u64§enable_tracing: bool§enable_metrics: bool§settings: HashMap<String, Value>§yaml_path: Option<PathBuf>§mode: ConfigModeImplementations§
Source§impl Config
impl Config
Sourcepub fn from_json_file(path: &Path) -> Result<Self, ModuleError>
pub fn from_json_file(path: &Path) -> Result<Self, ModuleError>
Load config from a JSON file, apply env overrides, and validate.
Sourcepub fn from_yaml_file(path: &Path) -> Result<Self, ModuleError>
pub fn from_yaml_file(path: &Path) -> Result<Self, ModuleError>
Load config from a YAML file, apply env overrides, and validate.
Sourcepub fn load(path: &Path) -> Result<Self, ModuleError>
pub fn load(path: &Path) -> Result<Self, ModuleError>
Auto-detect format by file extension and load.
Sourcepub fn validate(&self) -> Result<(), ModuleError>
pub fn validate(&self) -> Result<(), ModuleError>
Validate config constraints. Returns an error listing all violations.
Sourcepub fn from_defaults() -> Self
pub fn from_defaults() -> Self
Build config from defaults, applying env var overrides.
Sourcepub fn discover() -> Result<Self, ModuleError>
pub fn discover() -> Result<Self, ModuleError>
Discover and load config using the §9.14 search order.
If no file is found, returns Config::from_defaults().
Sourcepub fn get(&self, key: &str) -> Option<Value>
pub fn get(&self, key: &str) -> Option<Value>
Get a config value by dot-path key.
First checks typed fields (e.g. “executor.max_call_depth”), then falls
back to the settings HashMap for arbitrary nested config.
Sourcepub fn set(&mut self, key: &str, value: Value)
pub fn set(&mut self, key: &str, value: Value)
Set a config value by dot-path key.
Attempts to set typed fields first, then falls back to the settings HashMap.
Sourcepub fn reload(&mut self) -> Result<(), ModuleError>
pub fn reload(&mut self) -> Result<(), ModuleError>
Reload config from the stored yaml_path. Returns error if no path stored.
Sourcepub fn data(&self) -> Value
pub fn data(&self) -> Value
Return a serde_json::Value representing the full config as a nested
JSON object — typed fields merged on top of the settings map.
pub fn register_namespace(reg: NamespaceRegistration) -> Result<(), ModuleError>
Sourcepub fn env_map(mapping: HashMap<String, String>) -> Result<(), ModuleError>
pub fn env_map(mapping: HashMap<String, String>) -> Result<(), ModuleError>
Register global bare env var → top-level config key mappings.