F #5698: Add filter option in oned.conf for FireEdge (#1742)

This commit is contained in:
Jorge Miguel Lobo Escalona authored and GitHub committed 2022-02-02 11:45:40 +01:00
1 parent 9733184d33
commit fae6bcc92f
2 files changed
+20 -2

No files matched your search

@@ -51,6 +51,6 @@ export const systemService = {
if (!res?.id || res?.id !== httpCodes.ok.id) throw res?.data
return res?.data?.OPENNEBULA_CONFIGURATION
return res?.data
},
}
@@ -27,6 +27,15 @@ const { defaultEmptyFunction, httpMethod } = defaults
const { ok, internalServerError, badRequest } = httpCodes
const { GET } = httpMethod
const ALLOWED_KEYS_ONED_CONF = [
'DEFAULT_COST',
'DS_MAD_CONF',
'MARKET_MAD_CONF',
'VM_MAD',
'IM_MAD',
'AUTH_MAD',
]
/**
* Get system config.
*
@@ -79,7 +88,16 @@ const getConfig = (
return
}
res.locals.httpCode = httpResponse(ok, value)
const filterData = {}
Object.entries(value.OPENNEBULA_CONFIGURATION).forEach(
([keyOned, valueOned]) => {
if (ALLOWED_KEYS_ONED_CONF.includes(keyOned)) {
filterData[keyOned] = valueOned
}
}
)
res.locals.httpCode = httpResponse(ok, filterData)
next()
}
)