Skip to content

Commit 75f7663

Browse files
committed
Add Bool fallback for true and false strings
1 parent 6a31e52 commit 75f7663

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/Configuration/Providers/EnvironmentVariables/EnvironmentVariablesProvider.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ public struct EnvironmentVariablesProvider: Sendable {
145145

146146
/// A decoder of bool values from a string.
147147
static func decodeBool(from string: String) -> Bool? {
148-
switch string.lowercased() {
149-
case "true", "yes", "1": true
150-
case "false", "no", "0": false
151-
default: nil
148+
let stringLowercased = string.lowercased()
149+
return switch stringLowercased {
150+
case "yes", "1": true
151+
case "no", "0": false
152+
default: Bool(stringLowercased)
152153
}
153154
}
154155
}

0 commit comments

Comments
 (0)