Compare commits

...

1 Commits

Author SHA1 Message Date
Dora Korpar 678b19489d bf: ZENKO 1402 location constraint update event 2019-03-14 12:44:53 -07:00
2 changed files with 22 additions and 9 deletions

View File

@ -20,13 +20,6 @@ try {
let client;
let implName;
config.on('location-constraints-update', () => {
const clients = parseLC(config, vault);
client = new MultipleBackendGateway(
clients, metadata, locationStorageCheck);
implName = 'multipleBackends';
});
if (config.backends.data === 'mem') {
client = inMemory;
implName = 'mem';
@ -54,4 +47,14 @@ if (config.backends.data === 'mem') {
const data = new DataWrapper(
client, implName, config, kms, metadata, locationStorageCheck, vault);
config.on('location-constraints-update', () => {
if (implName === 'multipleBackends') {
const clients = parseLC(config, vault);
client = new MultipleBackendGateway(
clients, metadata, locationStorageCheck);
data.switch(client);
}
});
module.exports = { data, client, implName };

View File

@ -3,7 +3,7 @@ const https = require('https');
const cluster = require('cluster');
const { series } = require('async');
const arsenal = require('arsenal');
const { RedisClient, StatsClient } = require('arsenal').metrics;
const { RedisClient, StatsClient } = arsenal.metrics;
const monitoringClient = require('./utilities/monitoringHandler');
const logger = require('./utilities/logger');
@ -12,7 +12,7 @@ const { clientCheck } = require('./utilities/healthcheckHandler');
const _config = require('./Config').config;
const { blacklistedPrefixes } = require('../constants');
const api = require('./api/api');
const { client, implName } = require('./data/wrapper');
const dataWrapper = require('./data/wrapper');
const kms = require('./kms/wrapper');
const locationStorageCheck =
require('./api/apiUtils/object/locationStorageCheck');
@ -25,7 +25,10 @@ const {
} = require('./management/agentClient');
const routes = arsenal.s3routes.routes;
const { parseLC, MultipleBackendGateway } = arsenal.storage.data;
const websiteEndpoints = _config.websiteEndpoints;
let client = dataWrapper.client;
const implName = dataWrapper.implName;
let allEndpoints;
function updateAllEndpoints() {
@ -33,6 +36,13 @@ function updateAllEndpoints() {
}
_config.on('rest-endpoints-update', updateAllEndpoints);
updateAllEndpoints();
_config.on('location-constraints-update', () => {
if (implName === 'multipleBackends') {
const clients = parseLC(_config, vault);
client = new MultipleBackendGateway(
clients, metadata, locationStorageCheck);
}
});
// redis client
let localCacheClient;