mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04: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 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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue