summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYounessBird <67457600+YounessBird@users.noreply.github.com>2022-07-05 07:46:42 +0100
committerYounessBird <67457600+YounessBird@users.noreply.github.com>2022-07-14 10:22:46 +0100
commit9671e623706cf8a75d3898fc61822ea3b1be1250 (patch)
treeca0a6a3020d36ec4b38594eddfce4fe168268321
parentd2ee90ea23281b057dffa6515b274e5c7b82cf87 (diff)
change config methods to use lowercase keys
-rw-r--r--src/config.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs
index 27b318d..320b72e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -110,7 +110,8 @@ impl Config {
where
T: Into<Value>,
{
- self.defaults.insert(key.parse()?, value.into());
+ self.defaults
+ .insert(key.to_lowercase().as_str().parse()?, value.into());
#[allow(deprecated)]
self.refresh()
@@ -129,7 +130,8 @@ impl Config {
where
T: Into<Value>,
{
- self.overrides.insert(key.parse()?, value.into());
+ self.overrides
+ .insert(key.to_lowercase().as_str().parse()?, value.into());
#[allow(deprecated)]
self.refresh()
@@ -137,7 +139,7 @@ impl Config {
#[deprecated(since = "0.12.0", note = "please use 'ConfigBuilder' instead")]
pub fn set_once(&mut self, key: &str, value: Value) -> Result<()> {
- let expr: path::Expression = key.parse()?;
+ let expr: path::Expression = key.to_lowercase().as_str().parse()?;
// Traverse the cache using the path to (possibly) retrieve a value
if let Some(ref mut val) = expr.get_mut(&mut self.cache) {
@@ -149,6 +151,8 @@ impl Config {
}
pub fn get<'de, T: Deserialize<'de>>(&self, key: &str) -> Result<T> {
+ let k = key.to_lowercase();
+ let key = k.as_str();
// Parse the key into a path expression
let expr: path::Expression = key.parse()?;