2 stable releases

1.1.1 Sep 23, 2024
1.1.0 Sep 15, 2024
1.0.1 Sep 15, 2024

#205 in Configuration

MIT license

27KB
396 lines

Crates.io Workflow Status Average time to resolve an issue Percentage of issues still open Maintenance

config-more-formats

Add more formats to config.

This crate provides additional formats for figment. If you need additional formats, you can include this crate and use the provided formats.

Additionally, this adds a function to parse a file by its extension.

Supported formats added by this crate:

Format Feature Crate Description
YAML-NG yaml_ng serde-yaml-ng An actively maintained fork of serde_yaml
JAVA Properties properties serde-java-properties Java properties file format
HJSON hjson serde-hjson Human JSON
HCL hcl hcl-rs HashiCorp Configuration Language
Ason ason ason Ason format
JSON json serde_json config supplied JSON format
JSON5 json5 serde-json5 config supplied JSON5 format
RON ron ron config supplied RON format
TOML toml toml config supplied TOML format
YAML yaml yaml-rust config supplied YAML format (using deprecated serde_yaml)
INI ini ini config supplied INI format
all Enable all formats except for yaml

If you do not enable yaml, yaml_ng will be used for yaml files instead. Instead of all, enable only the formats you need to reduce compile times and dependencies.

The current development version of config already uses yaml-rust2 which is a fork of yaml-rust and is actively maintained. This crate uses serde_yaml_ng which is another actively maintained solution for YAML.

Example of by_file_extension

use config::Config;use config_more_formats::by_file_extension;


    let settings = Config::builder()
        .add_source(by_file_extension("settings.toml").unwrap())
        .build()
        .unwrap();

License

Licensed under

at your option.

Dependencies

~1.3–5MB
~105K SLoC