A library for Rust to simplify reading configuration files from various file formats.
Find a file
2025-04-14 19:50:00 +00:00
.github/workflows ci(deploy): tidy 2025-04-14 20:49:34 +01:00
.idea chore(intellij): update configs 2025-04-14 20:17:33 +01:00
src build: handle warnings when features disabled 2025-04-14 20:28:24 +01:00
test_configs feat: kdl support 2024-06-16 23:15:27 +01:00
.gitignore chore(release): v0.1.1 2023-03-13 22:58:27 +00:00
Cargo.lock chore(release): v0.5.1 2025-04-14 20:49:40 +01:00
Cargo.toml chore(release): v0.5.1 2025-04-14 20:49:40 +01:00
CHANGELOG.md chore: update CHANGELOG.md for v0.5.1 [skip ci] 2025-04-14 19:50:00 +00:00
LICENSE docs: add license 2023-03-12 20:19:21 +00:00
README.md docs(readme): add missing kdl link 2025-04-14 20:47:41 +01:00

Universal Config

crate | docs | repo

Universal Config is a library for Rust to simplify reading and writing configuration files. It is able to automatically locate config files from standard locations, and has support for various file formats.

The crate does not offer a lot of functionality, leaving that to Serde and your implementation. Instead, it just deals with loading and saving the file.

Currently, the following formats are supported:

  • JSON via serde_json
  • YAML via serde_yaml
  • TOML via toml
  • XML via serde_xml_rs
  • Corn via libcorn
  • KDL via kaydle
  • Ron via ron

Installation

Just add the crate:

cargo add universal-config

By default, support for all languages is included. You can enable/disable languages using feature flags. For example, in your Cargo.toml:

[dependencies.universal-config]
version = "0.1.0"
default-features = false
features = ["json", "toml"]

Example usage

use universal_config::ConfigLoader;
use serde::Deserialize;

#[derive(Deserialize)]
struct MyConfig {
    foo: String,
}

let config: MyConfig = ConfigLoader::new("my-app").find_and_load().unwrap();
println!("{}", config.foo);

For more advanced usage, please check the docs.