From e2b84e134a13067391b780a1fcc2b4865120c582 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Thu, 2 Mar 2023 20:49:40 +0100 Subject: [PATCH] fix: extend parsing of boolean environment vars Signed-off-by: Tilman Vatteroth --- lib/config/utils.js | 7 ++++++- public/docs/release-notes.md | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/config/utils.js b/lib/config/utils.js index cdb8f73ae..1fc98d01f 100644 --- a/lib/config/utils.js +++ b/lib/config/utils.js @@ -3,9 +3,14 @@ const fs = require('fs') const path = require('path') +function isPositiveAnswer (value) { + const lowerValue = value.toLowerCase() + return lowerValue === 'yes' || lowerValue === '1' || lowerValue === 'true' +} + exports.toBooleanConfig = function toBooleanConfig (configValue) { if (configValue && typeof configValue === 'string') { - return (configValue === 'true') + return (isPositiveAnswer(configValue)) } return configValue } diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index bf5639e2b..2fc82e09d 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -1,5 +1,10 @@ # Release Notes +## UNRELEASED + +### Enhancements +- Extend boolean environment variable parsing with other positive answers and case insensitivity. + ## 1.9.7 2023-02-19 ### Bugfixes