summaryrefslogtreecommitdiffstats
path: root/src/env.rs
diff options
context:
space:
mode:
authorbigduu <mugeng.du@qq.com>2023-03-25 23:24:02 +0800
committerbigduu <mugeng.du@qq.com>2023-07-22 00:56:35 +0800
commitb3d851878dd88a62c19cecf3e3bf8a8e2be5309a (patch)
tree6cc041ed5a389f30ec91d20387e05b43aa20816c /src/env.rs
parent267afbd4d8ef1f83a3c8af7145ebca51263f4d1b (diff)
Make the parse list key to lowercase when insert the keys
Signed-off-by: bigduu <mugeng.du@qq.com>
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/env.rs b/src/env.rs
index 8ede33d..7823383 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -153,10 +153,10 @@ impl Environment {
/// To switch the default type back to type Strings you need to provide the keys which should be [`Vec<String>`] using this function.
pub fn with_list_parse_key(mut self, key: &str) -> Self {
if self.list_parse_keys.is_none() {
- self.list_parse_keys = Some(vec![key.into()])
+ self.list_parse_keys = Some(vec![key.to_lowercase()])
} else {
self.list_parse_keys = self.list_parse_keys.map(|mut keys| {
- keys.push(key.into());
+ keys.push(key.to_lowercase());
keys
});
}
@@ -287,6 +287,9 @@ impl Source for Environment {
ValueKind::Float(parsed)
} else if let Some(separator) = &self.list_separator {
if let Some(keys) = &self.list_parse_keys {
+ #[cfg(feature = "convert-case")]
+ let key = key.to_lowercase();
+
if keys.contains(&key) {
let v: Vec<Value> = value
.split(separator)