Jesús Pérez 09a97ac8f5
chore: update platform submodule to monorepo crates structure
Platform restructured into crates/, added AI service and detector,
       migrated control-center-ui to Leptos 0.8
2026-01-08 21:32:59 +00:00

63 lines
1.8 KiB
Rust

//! Platform Config - Unified configuration loading for platform services
//!
//! This crate provides a unified interface for loading service configurations
//! from both Nickel (NCL) and TOML sources, with a hierarchical loading
//! strategy.
//!
//! # Features
//!
//! - **Dual Format Support**: Load configurations from `.ncl` (Nickel) or
//! `.toml` files
//! - **Hierarchical Loading**: Environment variables → File-based → Defaults
//! - **JSON Intermediate**: All configs converted to JSON for consistent
//! processing
//! - **Environment Overrides**: Service-specific env var overrides
//! - **Error Handling**: Rich, actionable error types
//!
//! # Usage
//!
//! Implement the `ConfigLoader` trait for your config struct:
//!
//! ```ignore
//! use platform_config::ConfigLoader;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Debug, Default, Serialize, Deserialize)]
//! pub struct MyServiceConfig {
//! pub server: ServerConfig,
//! pub database: DatabaseConfig,
//! }
//!
//! impl ConfigLoader for MyServiceConfig {
//! fn service_name() -> &'static str {
//! "my-service"
//! }
//!
//! fn load_from_hierarchy() -> Result<Self> {
//! // Use default hierarchy: env vars -> files -> defaults
//! Ok(Self::default())
//! }
//!
//! fn apply_env_overrides(&mut self) -> Result<()> {
//! // Apply service-specific overrides
//! Ok(())
//! }
//! }
//!
//! // Load config
//! let config = MyServiceConfig::load()?;
//! ```
pub mod error;
pub mod format;
pub mod hierarchy;
pub mod loader;
pub mod nickel;
// Re-export main types
pub use error::{ConfigError, Result};
pub use format::ConfigLoader;
pub use hierarchy::{config_base_path, find_config_file, resolve_config_path};
pub use loader::{ConfigLoaderExt, ConfigValidator};
pub use nickel::is_nickel_available;