mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 20:24:27 -05:00
d682695bf1
As minio causes various problem if you configure it using environment variables and leave the port setting out, which will evaluate to NaN, this change should fix this in a clean way for this time and helps to support numbers in general in future. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
22 lines
632 B
JavaScript
22 lines
632 B
JavaScript
'use strict'
|
|
|
|
exports.toBooleanConfig = function toBooleanConfig (configValue) {
|
|
if (configValue && typeof configValue === 'string') {
|
|
return (configValue === 'true')
|
|
}
|
|
return configValue
|
|
}
|
|
|
|
exports.toArrayConfig = function toArrayConfig (configValue, separator = ',', fallback) {
|
|
if (configValue && typeof configValue === 'string') {
|
|
return (configValue.split(separator).map(arrayItem => arrayItem.trim()))
|
|
}
|
|
return fallback
|
|
}
|
|
|
|
exports.toIntegerConfig = function toIntegerConfig (configValue) {
|
|
if (configValue && typeof configValue === 'string') {
|
|
return parseInt(configValue)
|
|
}
|
|
return configValue
|
|
}
|