Skip to main content

Module config

Module config 

Source
Expand description

统一配置管理模块

该模块提供了 ModuForge 核心模块的统一配置管理,解决了以下问题:

§主要功能

  1. 统一配置结构:将分散在各个模块中的配置统一管理
  2. 环境适配:提供开发、测试、生产环境的预设配置
  3. 配置验证:确保配置值的合理性和一致性
  4. 配置继承:支持配置的层级覆盖和继承
  5. 运行时调整:支持运行时动态调整部分配置

§使用示例

use mf_core::config::{ForgeConfig, Environment};

// 使用预设环境配置
let config = ForgeConfig::for_environment(Environment::Production);

// 自定义配置
let config = ForgeConfig::builder()
    .processor_config(ProcessorConfig {
        max_queue_size: 5000,
        max_concurrent_tasks: 20,
        ..Default::default()
    })
    .performance_config(PerformanceConfig {
        enable_monitoring: true,
        middleware_timeout_ms: 1000,
        ..Default::default()
    })
    .build();

Structs§

CacheConfig
缓存配置
EventConfig
事件系统配置
ExtensionConfig
扩展系统配置
ForgeConfig
统一的 Forge 配置结构
ForgeConfigBuilder
配置构建器
HistoryConfig
历史记录配置
PerformanceConfig
性能监控配置
ProcessorConfig
任务处理器配置
RuntimeConfig
运行时配置

Enums§

ConfigValidationError
配置验证错误
Environment
运行环境类型
RuntimeType
运行时类型选择