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:
parent
db6452a8c7
commit
a515e4239d
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user