Extend config with various options from 1.x

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-12-31 22:37:37 +01:00 committed by David Mehren
parent 18c6694bcb
commit 286575315e
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
13 changed files with 686 additions and 32 deletions
src/config

17
src/config/utils.ts Normal file
View file

@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const toArrayConfig = (configValue: string, separator = ',') => {
if (!configValue) {
return [];
}
if (!configValue.includes(separator)) {
return [configValue.trim()];
}
return configValue.split(separator).map((arrayItem) => arrayItem.trim());
};