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
| Feature | Enables | Default |
|---|---|---|
dotenv | .env via dotenvy | ✓ |
ini | .ini via rust-ini | ✓ |
toml | .toml via toml | ✓ |
yaml | .yaml/.yml via serde_yaml | ✓ |
cli | config-get binary via clap | ✗ |
all | All 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
ConfigGettype 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.