realme 0.1.4

A flexible and extensible configuration management library for Rust, designed to simplify the process of loading and managing configuration settings from various sources.
Documentation

Realme

Build License: GPLv3 Latest Version codecov

The name "Realme" is a play on "Realm" and "me," emphasizing its role in managing your application's configuration realm.

Realme is a flexible and extensible configuration management library for Rust. It simplifies the process of loading and managing configuration settings from various sources. Designed to work within an application, Realme can handle all types of configuration needs and formats.

Features

  • Supports multiple configuration formats
    • TOML
    • JSON
    • JSON5
    • YAML
    • RON
    • INI
  • Loosely typed — Serialization and deserialization of configuration data, configuration values may be read in any supported type, as long as there exists a reasonable conversion
  • Custom parser support and flexible adaptor system for different data sources
  • Setting defaults and set explicit values override
  • Reading from environment variables
  • Reading from command line flags
  • Live watching and re-reading of config files

Installation

Add this to your Cargo.toml:

toml
[dependencies]
realme = "0.1.2"

Usage

Here's a simple example of how to use Realme:

use realme::{TomlParser, StringSource, Adaptor,Realme};

fn main() {
    const CONFIGURATION1: &str = r#"key1 = "value""#;

    let realme = Realme::builder()
    .load(
        Adaptor::new(
            Box::new(
                StringSource::<TomlParser>::new(
                    CONFIGURATION1
            )))
        )
    .build()
    .expect("Building configuration object");

    let value :String = realme
        .get("key1")
        .expect("Accessing configuration object")
        .try_into().unwrap();

    println!("'key1' Config element is: '{value:?}'");
}

For more detailed examples, check the examples directory.

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Copyright

Copyright 2024 Jasper Zhang