Always use constants.SECRET_PLACEHOLDER

This commit is contained in:
Johannes Zellner
2020-05-14 23:01:44 +02:00
parent a1f263c048
commit 9bdeff0a39
17 changed files with 45 additions and 41 deletions
+3 -3
View File
@@ -21,8 +21,8 @@ exports = module.exports = {
var assert = require('assert'),
async = require('async'),
backups = require('../backups.js'),
BoxError = require('../boxerror.js'),
constants = require('../constants.js'),
debug = require('debug')('box:storage/gcs'),
EventEmitter = require('events'),
GCS = require('@google-cloud/storage').Storage,
@@ -254,10 +254,10 @@ function testConfig(apiConfig, callback) {
}
function removePrivateFields(apiConfig) {
apiConfig.credentials.private_key = backups.SECRET_PLACEHOLDER;
apiConfig.credentials.private_key = constants.SECRET_PLACEHOLDER;
return apiConfig;
}
function injectPrivateFields(newConfig, currentConfig) {
if (newConfig.credentials.private_key === backups.SECRET_PLACEHOLDER && currentConfig.credentials) newConfig.credentials.private_key = currentConfig.credentials.private_key;
if (newConfig.credentials.private_key === constants.SECRET_PLACEHOLDER && currentConfig.credentials) newConfig.credentials.private_key = currentConfig.credentials.private_key;
}