Update config parsing

This commit is contained in:
Angelina Filippova 2019-11-17 22:48:53 +09:00
parent 383397f685
commit a84cb569a1

View file

@ -22,6 +22,12 @@ const settings = {
const newSettings = data.reduce((acc, { group, key, value }) => { const newSettings = data.reduce((acc, { group, key, value }) => {
if (group === 'cors_plug') { if (group === 'cors_plug') {
acc[':cors_plug'] = { ...acc[':cors_plug'], [key]: value } acc[':cors_plug'] = { ...acc[':cors_plug'], [key]: value }
} else if (group === 'logger') {
const parsedValue = valueHasTuples(key, value) ? value : parseTuples(value, key)
acc[':logger'] = acc[':logger'] ? { ...acc[':logger'], [key]: parsedValue } : { [key]: parsedValue }
} else if (group === 'quack') {
const parsedValue = valueHasTuples(key, value) ? value : parseTuples(value, key)
acc[':quack'] = acc[':quack'] ? { ...acc[':quack'], [key]: parsedValue } : { [key]: parsedValue }
} else { } else {
const parsedValue = valueHasTuples(key, value) ? { value } : parseTuples(value, key) const parsedValue = valueHasTuples(key, value) ? { value } : parseTuples(value, key)
acc[key] = { ...acc[key], ...parsedValue } acc[key] = { ...acc[key], ...parsedValue }