mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
fix: extend parsing of boolean environment vars
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
29b3562672
commit
e2b84e134a
2 changed files with 11 additions and 1 deletions
|
@ -3,9 +3,14 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
function isPositiveAnswer (value) {
|
||||||
|
const lowerValue = value.toLowerCase()
|
||||||
|
return lowerValue === 'yes' || lowerValue === '1' || lowerValue === 'true'
|
||||||
|
}
|
||||||
|
|
||||||
exports.toBooleanConfig = function toBooleanConfig (configValue) {
|
exports.toBooleanConfig = function toBooleanConfig (configValue) {
|
||||||
if (configValue && typeof configValue === 'string') {
|
if (configValue && typeof configValue === 'string') {
|
||||||
return (configValue === 'true')
|
return (isPositiveAnswer(configValue))
|
||||||
}
|
}
|
||||||
return configValue
|
return configValue
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
# Release Notes
|
# Release Notes
|
||||||
|
|
||||||
|
## UNRELEASED
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
- Extend boolean environment variable parsing with other positive answers and case insensitivity.
|
||||||
|
|
||||||
## <i class="fa fa-tag"></i> 1.9.7 <i class="fa fa-calendar-o"></i> 2023-02-19
|
## <i class="fa fa-tag"></i> 1.9.7 <i class="fa fa-calendar-o"></i> 2023-02-19
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
Loading…
Reference in a new issue