Thanks to visit codestin.com
Credit goes to github.com

Skip to content

envconfig: fall back to default on invalid bool env values#14563

Open
umut-polat wants to merge 1 commit intoollama:mainfrom
umut-polat:fix/bool-with-default-fallback
Open

envconfig: fall back to default on invalid bool env values#14563
umut-polat wants to merge 1 commit intoollama:mainfrom
umut-polat:fix/bool-with-default-fallback

Conversation

@umut-polat
Copy link

BoolWithDefault returned true when strconv.ParseBool failed instead of returning the provided default value. This caused boolean flags to be silently enabled when a user set an env var to a common but invalid string like "yes", "on", or "enabled".

The fix changes the error fallback from return true to return defaultValue.

Fixes #14389

BoolWithDefault returned true when strconv.ParseBool failed instead
of returning the provided default value. This caused boolean flags
to be silently enabled when a user set an env var to a common but
invalid string like "yes", "on", or "enabled".

Fixes ollama#14389

Signed-off-by: umut-polat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BoolWithDefault silently returns true on invalid env var values instead of falling back to default

1 participant