Unverified Commit 3998fdcb authored by jthomson04's avatar jthomson04 Committed by GitHub
Browse files

feat: KVBM V2 Initial Migration (#3861)


Signed-off-by: default avatarjthomson04 <jwillthomson19@gmail.com>
parent e64d2f09
This diff is collapsed.
...@@ -397,6 +397,19 @@ pub fn is_truthy(val: &str) -> bool { ...@@ -397,6 +397,19 @@ pub fn is_truthy(val: &str) -> bool {
matches!(val.to_lowercase().as_str(), "1" | "true" | "on" | "yes") matches!(val.to_lowercase().as_str(), "1" | "true" | "on" | "yes")
} }
pub fn parse_bool(val: &str) -> anyhow::Result<bool> {
if is_truthy(val) {
Ok(true)
} else if is_falsey(val) {
Ok(false)
} else {
anyhow::bail!(
"Invalid boolean value: '{}'. Expected one of: true/false, 1/0, on/off, yes/no",
val
)
}
}
/// Check if a string is falsey /// Check if a string is falsey
/// This will be used to evaluate environment variables or any other subjective /// This will be used to evaluate environment variables or any other subjective
/// configuration parameters that can be set by the user that should be evaluated /// configuration parameters that can be set by the user that should be evaluated
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment