llm-config-core

Crates.iollm-config-core
lib.rsllm-config-core
version0.5.0
created_at2025-11-21 21:47:12.197092+00
updated_at2025-11-21 21:47:12.197092+00
descriptionCore configuration management library for LLM Config Manager with multi-environment support, versioning, and secret management
homepagehttps://github.com/globalbusinessadvisors/llm-config-manager
repositoryhttps://github.com/globalbusinessadvisors/llm-config-manager
max_upload_size
id1944322
size97,874
GBA (globalbusinessadvisors)

documentation

https://docs.rs/llm-config-manager

README

llm-config-core

Crates.io Documentation License

Core configuration management library for LLM Config Manager with multi-environment support, versioning, and secret management.

Features

  • Multi-Environment Support: Manage configurations across dev, staging, production, and custom environments
  • Secret Management: Encrypted storage of sensitive configuration values
  • Version Control: Track changes and rollback to previous configurations
  • Namespace Isolation: Organize configurations by application or service
  • Environment Overrides: Cascade configuration values with environment-specific overrides
  • Type Safety: Strong typing for configuration values with validation
  • Async/Await: Full async support with Tokio runtime

Usage

Add this to your Cargo.toml:

[dependencies]
llm-config-core = "0.5.0"
tokio = { version = "1", features = ["full"] }

Quick Start

use llm_config_core::{ConfigManager, Environment};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize configuration manager
    let config = ConfigManager::new("./config-data").await?;

    // Set a configuration value
    config.set(
        "app.database.url",
        "postgres://localhost/mydb",
        Environment::Development
    ).await?;

    // Get a configuration value
    let db_url = config.get("app.database.url", Environment::Development).await?;
    println!("Database URL: {}", db_url);

    Ok(())
}

Secret Management

// Store an encrypted secret
config.set_secret(
    "app.api.key",
    "my-secret-api-key",
    Environment::Production
).await?;

// Retrieve and decrypt the secret
let api_key = config.get_secret("app.api.key", Environment::Production).await?;

Version Control

// Get configuration history
let history = config.get_history("app.database.url").await?;
for version in history {
    println!("Version {}: {}", version.version, version.value);
}

// Rollback to previous version
config.rollback("app.database.url", 5).await?;

Environment Overrides

// Set base configuration
config.set("app.max_connections", "100", Environment::Base).await?;

// Override for production
config.set("app.max_connections", "500", Environment::Production).await?;

// Get with cascade (returns 500 for production, 100 for others)
let max_conns = config.get_with_overrides("app.max_connections", Environment::Production).await?;

Architecture

The core library is built on:

  • llm-config-storage: Persistent storage backend
  • llm-config-crypto: Encryption for secrets
  • Sled: Embedded database for fast access
  • Tokio: Async runtime for concurrent operations

Performance

Benchmarks on modern hardware:

  • Configuration retrieval: ~50 µs
  • Configuration updates: ~100 µs
  • With encryption: ~120 µs
  • Batch operations: ~10,000 ops/sec

Minimum Supported Rust Version

This crate requires Rust 1.75 or later.

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Contributing

See CONTRIBUTING.md for contribution guidelines.

Commit count: 0

cargo fmt