All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Allow enums as configuration keys #119
- Remove lowercasing of keys (unless the key is coming from an environment variable).
- Update nom to 5.x
- Support deserializing to a struct with
#[serde(default)]
#106
- Support reading
enum
s from configuration. #85 - Improvements to error path (attempting to propagate path). #89
- Fix UB in monomorphic expansion. We weren't re-exporting dependent types. #91
- Allow Environment variable collection to ignore empty values. #78
// Empty env variables will not be collected Environment::with_prefix("APP").ignore_empty(true)
-
Breaking Change: Environment does not declare a separator by default.
// 0.8.0 Environment::with_prefix("APP") // 0.9.0 Environment::with_prefix("APP").separator("_")
-
Add support for INI. #72
-
Add support for newtype structs. #71
-
Fix bug with array set by path. #69
-
Update to nom 4. #63
- Update lazy_static and yaml_rust
- Be compatible with nom's verbose_errors feature (#50)[rust-cli#50]
- Add
derive(PartialEq)
for Value (#54)[rust-cli#54]
- Fix conflict with
serde_yaml
. #39
-
Implement
Source
forConfig
. -
Implement
serde::de::Deserializer
forConfig
.my_config.deserialize
may now be called as eitherDeserialize::deserialize(my_config)
ormy_config.try_into()
. -
Remove
ConfigResult
. The builder pattern requires either.try_into
as the final step or the initialConfig::new()
to be bound to a slot. Errors must also be handled on each call instead of at the end of the chain.let mut c = Config::new(); c .merge(File::with_name("Settings")).unwrap() .merge(Environment::with_prefix("APP")).unwrap();
let c = Config::new() .merge(File::with_name("Settings")).unwrap() .merge(Environment::with_prefix("APP")).unwrap() // LLVM should be smart enough to remove the actual clone operation // as you are cloning a temporary that is dropped at the same time .clone();
let mut s: Settings = Config::new() .merge(File::with_name("Settings")).unwrap() .merge(Environment::with_prefix("APP")).unwrap() .try_into();
-
Implement
Source
forVec<T: Source>
andVec<Box<Source>>
Config::new() .merge(vec![ File::with_name("config/default"), File::with_name(&format!("config/{}", run_mode)), ])
-
Implement
From<&Path>
andFrom<PathBuf>
forFile
-
Remove
namespace
option for File -
Add builder pattern to condense configuration
Config::new() .merge(File::with_name("Settings")) .merge(Environment::with_prefix("APP")) .unwrap()
-
Parsing errors even for non required files – @Anthony25 ( #33 )
- Added config category to Cargo.toml
config.get
has been changed to take a type parameter and to deserialize into that type using serde. Old behavior (get a value variant) can be used by passingconfig::Value
as the type parameter:my_config.get::<config::Value>("..")
. Some great help here from @impowski in #25.- Propagate parse and type errors through the deep merge (remembering filename, line, etc.)
- Remove directory traversal on
File
. This is likely temporary. I do want this behavior but I can see how it should be optional. See #35 - Add
File::with_name
to get automatic file format detection instead of manualFileFormat::*
– @JordiPolo - Case normalization #26
- Remove many possible panics #8
my_config.refresh()
will do a full re-read from the source so live configuration is possible with some work to watch the file
-
Remove global (
config::get
) API — It's now required to create a local configuration instance withconfig::Config::new()
first.If you'd like to have a global configuration instance, use
lazy_static!
as follows:use std::sync::RwLock; use config::Config; lazy_static! { static ref CONFIG: RwLock<Config> = Default::default(); }
- YAML from @tmccombs
- Nested field retrieval
- Deep merging of sources (was shallow)
config::File::from_str
to parse and merge a file from a string- Support for retrieval of maps and slices —
config::get_table
andconfig::get_array
Initial release.