1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

M #~: Fix unsupported method on node < v12.0.0 (#1949)

This commit is contained in:
Sergio Betanzos 2022-04-18 18:43:19 +02:00 committed by Ruben S. Montero
parent db6452a8c7
commit a515e4239d
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -86,12 +86,10 @@ const readYAMLFile = (filePath = '', onError = defaultEmptyFunction) => {
* @param {Array} [keys] - List of keys to filter
* @returns {object} Filtered object
*/
const filterByProtectedKeys = (config = {}, keys = []) => {
const entries = Object.entries(config)
const filteredEntries = entries.filter(([key]) => !keys.includes(key))
return Object.fromEntries(filteredEntries)
}
const filterByProtectedKeys = (config = {}, keys = []) =>
Object.keys(config)
.filter((key) => !keys.includes(key))
.reduce((newConf, key) => ({ ...newConf, [key]: config[key] }), {})
/**
* @typedef GetConfigurationOptions
@ -112,7 +110,7 @@ const getConfiguration = (
) => {
const config = readYAMLFile(getConfigPathByApp(app), onError)
if (config && includeProtectedConfig) {
if (config && !includeProtectedConfig) {
return filterByProtectedKeys(config, getProtectedKeysByApp(app))
}