domains: remove SECRET_PLACEHOLDER from responses
This commit is contained in:
+12
-12
@@ -1,15 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
const assert = require('node:assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
constants = require('../constants.js'),
|
||||
@@ -36,12 +26,12 @@ function formatError(response) {
|
||||
}
|
||||
|
||||
function removePrivateFields(domainObject) {
|
||||
domainObject.config.accessKey = constants.SECRET_PLACEHOLDER;
|
||||
delete domainObject.config.accessKey;
|
||||
return domainObject;
|
||||
}
|
||||
|
||||
function injectPrivateFields(newConfig, currentConfig) {
|
||||
if (newConfig.accessKey === constants.SECRET_PLACEHOLDER) newConfig.accessKey = currentConfig.accessKey;
|
||||
if (!Object.hasOwn(newConfig, 'accessKey')) newConfig.accessKey = currentConfig.accessKey;
|
||||
}
|
||||
|
||||
async function getZoneId(domainConfig, zoneName) {
|
||||
@@ -255,3 +245,13 @@ async function verifyDomainConfig(domainObject) {
|
||||
|
||||
return credentials;
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user