Skip to main content

Crate config_get

Crate config_get 

Source
Expand description

§config-get

Cross-platform configuration file locator and reader for Rust.

config-get automatically discovers and reads configuration files from standard OS-specific locations, supporting .env, .ini, .toml, .json, .yml, and .yaml formats — no manual path wrangling required.

§Quick start

let cfg = ConfigGet::builder("myapp")
    .config_dir("myapp")
    .build()?;

let host = cfg.get("DB_HOST").unwrap_or("localhost");
let port: u16 = cfg.parse("DB_PORT")?;
let debug = cfg.get_in_or("server", "debug", "false");

§Features

FeatureEnablesDefault
dotenv.env via dotenvy
ini.ini via rust-ini
toml.toml via toml
yaml.yaml/.yml via serde_yaml
cliconfig-get binary via clap
allAll of the above

Re-exports§

pub use config_get::ConfigGet;
pub use config_get::ConfigGetBuilder;
pub use error::ConfigError;
pub use error::Result;
pub use format::Format;
pub use value::ConfigMap;

Modules§

config_get
Core ConfigGet type and its builder.
discovery
Platform-aware directory search logic.
error
Error types for this crate.
format
Supported file format detection.
parsers
Format-specific parsers.
value
Internal key/value storage.

Functions§

get_config_file
Convenience function — returns the path of the first matching config file, or None.