fix: fix dotenv loader inconsistent and many ui issues
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
pub mod errors;
|
||||
pub mod loose;
|
||||
|
||||
pub use errors::OptDynErr;
|
||||
pub use loose::BooleanLike;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum BooleanLike {
|
||||
Boolean(bool),
|
||||
String(String),
|
||||
Number(i32),
|
||||
}
|
||||
|
||||
impl BooleanLike {
|
||||
pub fn as_bool(&self) -> bool {
|
||||
match self {
|
||||
BooleanLike::Boolean(b) => *b,
|
||||
BooleanLike::String(s) => s.to_lowercase() == "true",
|
||||
BooleanLike::Number(n) => *n != 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user