Skip to content

Commit

Permalink
adapt config require on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Sep 18, 2024
1 parent 1c10fe0 commit 6345bba
Show file tree
Hide file tree
Showing 41 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion bin/backbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const werelogs = require('werelogs');
const runServer = require('../lib/api/BackbeatServer');
const { initManagement } = require('../lib/management/index');
const setupIngestionSiteMock = require('../tests/utils/mockIngestionSite');
const config = require('../lib/Config');
const { config } = require('../lib/Config');
const Logger = werelogs.Logger;
const log = new Logger('BackbeatServer:index');

Expand Down
2 changes: 1 addition & 1 deletion bin/ingestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils;
const { reshapeExceptionError } = require('arsenal').errorUtils;

const IngestionPopulator = require('../lib/queuePopulator/IngestionPopulator');
const config = require('../lib/Config');
const { config } = require('../lib/Config');
const { initManagement } = require('../lib/management/index');
const ZookeeperManager = require('../lib/clients/ZookeeperManager');
const { zookeeperNamespace, zkStatePath } =
Expand Down
2 changes: 1 addition & 1 deletion bin/queuePopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const schedule = require('node-schedule');

const werelogs = require('werelogs');

const config = require('../lib/Config');
const { config } = require('../lib/Config');
const zkConfig = config.zookeeper;
const kafkaConfig = config.kafka;
const extConfigs = config.extensions;
Expand Down
2 changes: 1 addition & 1 deletion bin/replication.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const werelogs = require('werelogs');
const Logger = werelogs.Logger;
const { RoundRobin } = require('arsenal').network;

const config = require('../lib/Config');
const { config } = require('../lib/Config');
const SetupReplication =
require('../extensions/replication/utils/SetupReplication');
const version = require('../package.json').version;
Expand Down
2 changes: 1 addition & 1 deletion extensions/gc/GarbageCollectorProducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Logger } = require('werelogs');

const BackbeatProducer = require('../../lib/BackbeatProducer');
const config = require('../../lib/Config');
const { config } = require('../../lib/Config');

class GarbageCollectorProducer {
/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/gc/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { ZenkoMetrics } = require('arsenal').metrics;
const GarbageCollector = require('./GarbageCollector');
const { startProbeServer } = require('../../lib/util/probe');
const { initManagement } = require('../../lib/management');
const config = require('../../lib/Config');
const { config } = require('../../lib/Config');

const kafkaConfig = config.kafka;
const s3Config = config.s3;
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/LifecycleQueuePopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LIFEYCLE_POPULATOR_CLIENT_ID = 'lifecycle-populator';
const METASTORE = '__metastore';
const VaultClientWrapper = require('../utils/VaultClientWrapper');

const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const {
coldStorageRestoreAdjustTopicPrefix,
coldStorageRestoreTopicPrefix,
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/bucketProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { initManagement } = require('../../../lib/management/index');
const LifecycleBucketProcessor = require('./LifecycleBucketProcessor');
const { applyBucketLifecycleWorkflows } = require('../management');
const { startProbeServer } = require('../../../lib/util/probe');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');

const { zookeeper, kafka, extensions, s3, log, queuePopulator } = config;
const lcConfig = extensions.lifecycle;
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/conductor/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils;
const { ZenkoMetrics } = require('arsenal').metrics;

const LifecycleConductor = require('./LifecycleConductor');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const { startProbeServer } = require('../../../lib/util/probe');

const zkConfig = config.zookeeper;
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/management.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AWS = require('aws-sdk');
const werelogs = require('werelogs');

const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const management = require('../../lib/management/index');
const { TIMEOUT_MS } = require('../../lib/clients/utils');

Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/objectProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { initManagement } = require('../../../lib/management/index');
const LifecycleObjectExpirationProcessor = require('./LifecycleObjectExpirationProcessor');
const LifecycleObjectTransitionProcessor = require('./LifecycleObjectTransitionProcessor');
const { startProbeServer } = require('../../../lib/util/probe');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');

const zkConfig = config.zookeeper;
const kafkaConfig = config.kafka;
Expand Down
2 changes: 1 addition & 1 deletion extensions/lifecycle/tasks/LifecycleTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
} = require('arsenal').s3middleware.lifecycleHelpers;
const { CompareResult, MinHeap } = require('arsenal').algorithms.Heap;

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const { attachReqUids } = require('../../../lib/clients/utils');
const BackbeatTask = require('../../../lib/tasks/BackbeatTask');
const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry');
Expand Down
10 changes: 5 additions & 5 deletions extensions/mongoProcessor/MongoQueueProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const MongoClient = require('arsenal').storage
const ObjectMD = require('arsenal').models.ObjectMD;
const { extractVersionId } = require('../../lib/util/versioning');

const Config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const BackbeatConsumer = require('../../lib/BackbeatConsumer');
const QueueEntry = require('../../lib/models/QueueEntry');
const DeleteOpQueueEntry = require('../../lib/models/DeleteOpQueueEntry');
Expand Down Expand Up @@ -74,7 +74,7 @@ class MongoQueueProcessor {
this.logger = new Logger('Backbeat:Ingestion:MongoProcessor');
this.mongoClientConfig.logger = this.logger;
this._mongoClient = new MongoClient(this.mongoClientConfig);
this._bucketMemState = new BucketMemState(Config);
this._bucketMemState = new BucketMemState(config);

// in-mem batch of metrics, we only track total entry count by location
// this._accruedMetrics = { zenko-location: 10 }
Expand Down Expand Up @@ -123,9 +123,9 @@ class MongoQueueProcessor {
process.exit(1);
}

this._bootstrapList = Config.getBootstrapList();
Config.on('bootstrap-list-update', () => {
this._bootstrapList = Config.getBootstrapList();
this._bootstrapList = config.getBootstrapList();
config.on('bootstrap-list-update', () => {
this._bootstrapList = config.getBootstrapList();
});

let consumerReady = false;
Expand Down
2 changes: 1 addition & 1 deletion extensions/mongoProcessor/mongoProcessorTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils;
const { ZenkoMetrics } = require('arsenal').metrics;

const MongoQueueProcessor = require('./MongoQueueProcessor');
const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const { initManagement } = require('../../lib/management/index');
const { startProbeServer } = require('../../lib/util/probe');

Expand Down
2 changes: 1 addition & 1 deletion extensions/notification/queueProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { sendSuccess, sendError } = require('arsenal').network.probe.Utils;
const QueueProcessor = require('./QueueProcessor');
const { startProbeServer } = require('../../../lib/util/probe');

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const kafkaConfig = config.kafka;
const notifConfig = config.extensions.notification;
const mongoConfig = config.queuePopulator.mongo;
Expand Down
2 changes: 1 addition & 1 deletion extensions/oplogPopulator/OplogPopulatorTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const werelogs = require('werelogs');
const { errors } = require('arsenal');

const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const OplogPopulator = require('./OplogPopulator');

const {
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/ReplicationAPI.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const locations = require('../../conf/locationConfig.json') || {};

const ActionQueueEntry = require('../../lib/models/ActionQueueEntry');
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/ReplicationMetrics.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { ZenkoMetrics } = require('arsenal').metrics;

const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const { promMetricNames } = require('./constants');

const SIZE_BUCKETS = [
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/failedCRR/FailedCRRConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const redisClient = require('../../replication/utils/getRedisClient')();
const FailedCRRProducer = require('./FailedCRRProducer');
const BackbeatConsumer = require('../../../lib/BackbeatConsumer');
const BackbeatTask = require('../../../lib/tasks/BackbeatTask');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');

// BackbeatConsumer constant defaults
const CONSUMER_FETCH_MAX_BYTES = 5000020;
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/failedCRR/FailedCRRProducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { Logger } = require('werelogs');

const BackbeatProducer = require('../../../lib/BackbeatProducer');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');

class FailedCRRProducer {
/**
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/management.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const async = require('async');
const AWS = require('aws-sdk');
const werelogs = require('werelogs');

const config = require('../../lib/Config');
const { config } = require('../../lib/Config');
const management = require('../../lib/management/index');

const logger = new werelogs.Logger('mdManagement:replication');
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/queueProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const werelogs = require('werelogs');

const QueueProcessor = require('./QueueProcessor');
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const { initManagement } = require('../../../lib/management/index');
const { applyBucketReplicationWorkflows } = require('../management');
const { reshapeExceptionError } = require('arsenal').errorUtils;
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/replicationStatusProcessor/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { startProbeServer } = require('../../../lib/util/probe');
const { DEFAULT_LIVE_ROUTE, DEFAULT_METRICS_ROUTE, DEFAULT_READY_ROUTE } =
require('arsenal').network.probe.ProbeServer;

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const kafkaConfig = config.kafka;
const repConfig = config.extensions.replication;
const sourceConfig = repConfig.source;
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/tasks/UpdateReplicationStatus.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const errors = require('arsenal').errors;
const assert = require('assert');

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');

const ObjectQueueEntry = require('../../../lib/models/ObjectQueueEntry');
const ActionQueueEntry = require('../../../lib/models/ActionQueueEntry');
Expand Down
2 changes: 1 addition & 1 deletion extensions/replication/utils/getRedisClient.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { RedisClient } = require('arsenal').metrics;
const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const werelogs = require('werelogs');

const log = new werelogs.Logger('Backbeat:RedisClient');
Expand Down
2 changes: 1 addition & 1 deletion lib/clients/VaultClientCache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const config = require('../Config');
const { config } = require('../Config');

const VaultClient = require('vaultclient').Client;

Expand Down
2 changes: 1 addition & 1 deletion lib/management/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const config = require('../Config');
const { config } = require('../Config');
const werelogs = require('werelogs');

werelogs.configure({
Expand Down
2 changes: 1 addition & 1 deletion lib/management/operatorBackend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const arsenal = require('arsenal');
const config = require('../Config');
const { config } = require('../Config');
const werelogs = require('werelogs');

const { reshapeExceptionError } = arsenal.errorUtils;
Expand Down
2 changes: 1 addition & 1 deletion lib/management/patchConfiguration.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'; // eslint-disable-line strict

const async = require('async');
const config = require('../Config');
const { config } = require('../Config');
const bucketclient = require('bucketclient');
const { patchLocations } = require('arsenal').patches.locationConstraints;
const Metadata = require('arsenal').storage.metadata.MetadataWrapper;
Expand Down
2 changes: 1 addition & 1 deletion lib/management/pensieveBackend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const async = require('async');
const arsenal = require('arsenal');
const { decryptSecret } = arsenal.pensieve.credentialUtils;
const config = require('../Config');
const { config } = require('../Config');
const werelogs = require('werelogs');
const bucketclient = require('bucketclient');

Expand Down
2 changes: 1 addition & 1 deletion lib/queuePopulator/IngestionPopulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { CircuitBreaker, BreakerState } = require('breakbeat').CircuitBreaker;

const Logger = require('werelogs').Logger;

const config = require('../Config');
const { config } = require('../Config');
const IngestionReader = require('./IngestionReader');
const BackbeatProducer = require('../BackbeatProducer');
const MetricsConsumer = require('../MetricsConsumer');
Expand Down
2 changes: 1 addition & 1 deletion lib/queuePopulator/LogReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const async = require('async');

const jsutil = require('arsenal').jsutil;

const config = require('../Config');
const { config } = require('../Config');
const BackbeatProducer = require('../BackbeatProducer');
const ReplicationQueuePopulator =
require('../../extensions/replication/ReplicationQueuePopulator');
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const querystring = require('querystring');
const { RedisClient } = require('arsenal').metrics;
const { StatsModel } = require('arsenal').metrics;

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const getUrl = require('../utils/getUrl');
const { addMembers, addManyMembers } = require('../utils/sortedSetHelpers');
const { makeRetryPOSTRequest, getRequest, getResponseBody } =
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const zookeeper = require('node-zookeeper-client');
const { RedisClient } = require('arsenal').metrics;
const { StatsModel } = require('arsenal').metrics;

const config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const { makeRequest, getRequest, getResponseBody } =
require('../utils/httpHelpers');
const getUrl = require('../utils/getUrl');
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/ingestion/pauseResumeState.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ZKStateHelper = require('../utils/pauseResumeUtils/zkStateHelper');
const MockAPI = require('../utils/pauseResumeUtils/mockAPI');

// Configs
const Config = require('../../../lib/Config');
const { config } = require('../../../lib/Config');
const testConfig = require('../../config.json');
const { zookeeperNamespace } =
require('../../../extensions/ingestion/constants');
Expand Down Expand Up @@ -77,7 +77,7 @@ class IngestionPopulatorMock extends IngestionPopulator {
assert.ifError(err);

const buckets = [firstBucket, secondBucket];
Config.setIngestionBuckets(existingLocationConstraints, buckets);
config.setIngestionBuckets(existingLocationConstraints, buckets);

return cb(err);
});
Expand Down
26 changes: 13 additions & 13 deletions tests/performance/lifecycle/conductor-check-memory-balloon.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const assert = require('assert');
const async = require('async');

const baseConfig = require('../../../lib/Config');
baseConfig.zookeeper.autoCreateNamespace = true;
const mongoConfig = baseConfig.queuePopulator.mongo;
const { config } = require('../../../lib/Config');
config.zookeeper.autoCreateNamespace = true;
const mongoConfig = config.queuePopulator.mongo;
const LifecycleConductor = require('../../../extensions/lifecycle/conductor/LifecycleConductor');
const { BackbeatMetadataProxyMock } = require('../../functional/lifecycle/utils');

Expand All @@ -14,7 +14,7 @@ describe('Lifecycle Conductor', function testBackpressure() {

describe('with bucketd', () => {
const lcConfig = {
...baseConfig.extensions.lifecycle,
...config.extensions.lifecycle,
auth: {
type: '',
},
Expand All @@ -34,11 +34,11 @@ describe('Lifecycle Conductor', function testBackpressure() {
};

const lc = new LifecycleConductor(
baseConfig.zookeeper,
baseConfig.kafka,
config.zookeeper,
config.kafka,
lcConfig,
baseConfig.extensions.replication,
baseConfig.s3,
config.extensions.replication,
config.s3,
);

it('should apply backpressure on bucket queue instead of ballooning', done => {
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('Lifecycle Conductor', function testBackpressure() {

describe('with mongodb', () => {
const lcConfig = {
...baseConfig.extensions.lifecycle,
...config.extensions.lifecycle,
auth: {
type: '',
},
Expand All @@ -83,16 +83,16 @@ describe('Lifecycle Conductor', function testBackpressure() {
};

const zookeeperConfig = {
...baseConfig.zookeeper,
...config.zookeeper,
autoCreateNamespace: true,
};

const lc = new LifecycleConductor(
zookeeperConfig,
baseConfig.kafka,
config.kafka,
lcConfig,
baseConfig.extensions.replication,
baseConfig.s3,
config.extensions.replication,
config.s3,
);

const injectAccounts = client => {
Expand Down
Loading

0 comments on commit 6345bba

Please sign in to comment.