From 686702a38e5ffb3f5e78755374252bfbd448c677 Mon Sep 17 00:00:00 2001 From: Taylor McKinnon Date: Tue, 5 Jun 2018 12:58:52 -0700 Subject: [PATCH] bf/ZENKO-469 Add reload hook and location error handling --- lib/api/objectGet.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/api/objectGet.js b/lib/api/objectGet.js index e9c214ea6b..0316358f8e 100644 --- a/lib/api/objectGet.js +++ b/lib/api/objectGet.js @@ -15,13 +15,18 @@ const getReplicationBackendDataLocator = require('./apiUtils/object/getReplicationBackendDataLocator'); const { metadataValidateBucketAndObj } = require('../metadata/metadataUtils'); const { config } = require('../Config'); -const { locationConstraints } = config; +let { locationConstraints } = config; + +config.on('location-constraints-update', () => { + locationConstraints = config.locationConstraints; +}); const validateHeaders = s3middleware.validateConditionalHeaders; function _retrieveDefaultRead(locationName, objectKey, bucketName) { const readLocation = locationConstraints[locationName]; - const bucketMatch = readLocation.details.bucketMatch; + const bucketMatch = 'details' in readLocation ? + readLocation.details.bucketMatch : true; const backendKey = bucketMatch ? objectKey : `${bucketName}/${objectKey}`; return {