From a26ae735974bfb0666455f5fe7ffc84a3b707756 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Mon, 12 Jul 2021 17:47:18 +0100 Subject: [PATCH] [misc] switch from settings-sharelatex to @overleaf/settings --- services/real-time/app.js | 2 +- services/real-time/app/js/ChannelManager.js | 2 +- .../real-time/app/js/ConnectedUsersManager.js | 2 +- .../real-time/app/js/DeploymentManager.js | 2 +- .../app/js/DocumentUpdaterController.js | 2 +- .../app/js/DocumentUpdaterManager.js | 2 +- services/real-time/app/js/EventLogger.js | 2 +- services/real-time/app/js/Router.js | 2 +- services/real-time/app/js/SafeJsonParse.js | 2 +- services/real-time/app/js/WebApiManager.js | 2 +- .../real-time/app/js/WebsocketLoadBalancer.js | 2 +- services/real-time/package-lock.json | 20 +++++-------------- services/real-time/package.json | 2 +- .../test/acceptance/js/ApplyUpdateTests.js | 2 +- .../test/acceptance/js/DrainManagerTests.js | 2 +- .../test/acceptance/js/EarlyDisconnect.js | 2 +- .../test/acceptance/js/LeaveProjectTests.js | 2 +- .../test/acceptance/js/MatrixTests.js | 2 +- .../test/acceptance/js/PubSubRace.js | 2 +- .../test/acceptance/js/ReceiveUpdateTests.js | 2 +- .../test/acceptance/js/SessionSocketsTests.js | 2 +- .../acceptance/js/helpers/RealTimeClient.js | 2 +- .../acceptance/js/helpers/RealtimeServer.js | 2 +- .../test/unit/js/ChannelManagerTests.js | 2 +- .../unit/js/ConnectedUsersManagerTests.js | 2 +- .../unit/js/DocumentUpdaterControllerTests.js | 2 +- .../unit/js/DocumentUpdaterManagerTests.js | 2 +- .../test/unit/js/RoomManagerTests.js | 2 +- .../test/unit/js/SafeJsonParseTest.js | 2 +- .../test/unit/js/WebApiManagerTests.js | 2 +- 30 files changed, 34 insertions(+), 44 deletions(-) diff --git a/services/real-time/app.js b/services/real-time/app.js index bde00b2e17..0b8be4d17b 100644 --- a/services/real-time/app.js +++ b/services/real-time/app.js @@ -1,5 +1,5 @@ const Metrics = require('@overleaf/metrics') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') Metrics.initialize(Settings.appName || 'real-time') const async = require('async') diff --git a/services/real-time/app/js/ChannelManager.js b/services/real-time/app/js/ChannelManager.js index 1ca9f6e88b..c777fb2250 100644 --- a/services/real-time/app/js/ChannelManager.js +++ b/services/real-time/app/js/ChannelManager.js @@ -1,6 +1,6 @@ const logger = require('logger-sharelatex') const metrics = require('@overleaf/metrics') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const OError = require('@overleaf/o-error') const ClientMap = new Map() // for each redis client, store a Map of subscribed channels (channelname -> subscribe promise) diff --git a/services/real-time/app/js/ConnectedUsersManager.js b/services/real-time/app/js/ConnectedUsersManager.js index 6b98043ff7..006e763645 100644 --- a/services/real-time/app/js/ConnectedUsersManager.js +++ b/services/real-time/app/js/ConnectedUsersManager.js @@ -2,7 +2,7 @@ camelcase, */ const async = require('async') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const logger = require('logger-sharelatex') const redis = require('@overleaf/redis-wrapper') const OError = require('@overleaf/o-error') diff --git a/services/real-time/app/js/DeploymentManager.js b/services/real-time/app/js/DeploymentManager.js index ddb98fd4ce..fd482740f5 100644 --- a/services/real-time/app/js/DeploymentManager.js +++ b/services/real-time/app/js/DeploymentManager.js @@ -1,5 +1,5 @@ const logger = require('logger-sharelatex') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const fs = require('fs') // Monitor a status file (e.g. /etc/real_time_status) periodically and close the diff --git a/services/real-time/app/js/DocumentUpdaterController.js b/services/real-time/app/js/DocumentUpdaterController.js index 0e51339600..7ce516524c 100644 --- a/services/real-time/app/js/DocumentUpdaterController.js +++ b/services/real-time/app/js/DocumentUpdaterController.js @@ -2,7 +2,7 @@ camelcase, */ const logger = require('logger-sharelatex') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const RedisClientManager = require('./RedisClientManager') const SafeJsonParse = require('./SafeJsonParse') const EventLogger = require('./EventLogger') diff --git a/services/real-time/app/js/DocumentUpdaterManager.js b/services/real-time/app/js/DocumentUpdaterManager.js index 39bef96ebd..715d1a70d3 100644 --- a/services/real-time/app/js/DocumentUpdaterManager.js +++ b/services/real-time/app/js/DocumentUpdaterManager.js @@ -5,7 +5,7 @@ const request = require('request') const _ = require('underscore') const OError = require('@overleaf/o-error') const logger = require('logger-sharelatex') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const metrics = require('@overleaf/metrics') const { ClientRequestedMissingOpsError, diff --git a/services/real-time/app/js/EventLogger.js b/services/real-time/app/js/EventLogger.js index 1a2d898577..e6baffaa50 100644 --- a/services/real-time/app/js/EventLogger.js +++ b/services/real-time/app/js/EventLogger.js @@ -4,7 +4,7 @@ let EventLogger const logger = require('logger-sharelatex') const metrics = require('@overleaf/metrics') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') // keep track of message counters to detect duplicate and out of order events // messsage ids have the format "UNIQUEHOSTKEY-COUNTER" diff --git a/services/real-time/app/js/Router.js b/services/real-time/app/js/Router.js index 28765ecfa8..85b48eaf66 100644 --- a/services/real-time/app/js/Router.js +++ b/services/real-time/app/js/Router.js @@ -3,7 +3,7 @@ */ const metrics = require('@overleaf/metrics') const logger = require('logger-sharelatex') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const WebsocketController = require('./WebsocketController') const HttpController = require('./HttpController') const HttpApiController = require('./HttpApiController') diff --git a/services/real-time/app/js/SafeJsonParse.js b/services/real-time/app/js/SafeJsonParse.js index a8a3afae4d..b66f032ec6 100644 --- a/services/real-time/app/js/SafeJsonParse.js +++ b/services/real-time/app/js/SafeJsonParse.js @@ -1,4 +1,4 @@ -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const { DataTooLargeToParseError } = require('./Errors') module.exports = { diff --git a/services/real-time/app/js/WebApiManager.js b/services/real-time/app/js/WebApiManager.js index 403de53cfe..c5ac369149 100644 --- a/services/real-time/app/js/WebApiManager.js +++ b/services/real-time/app/js/WebApiManager.js @@ -3,7 +3,7 @@ */ const request = require('request') const OError = require('@overleaf/o-error') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const logger = require('logger-sharelatex') const { CodedError, diff --git a/services/real-time/app/js/WebsocketLoadBalancer.js b/services/real-time/app/js/WebsocketLoadBalancer.js index ee6ba4d335..4f1a4935a7 100644 --- a/services/real-time/app/js/WebsocketLoadBalancer.js +++ b/services/real-time/app/js/WebsocketLoadBalancer.js @@ -1,7 +1,7 @@ /* eslint-disable camelcase, */ -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const logger = require('logger-sharelatex') const RedisClientManager = require('./RedisClientManager') const SafeJsonParse = require('./SafeJsonParse') diff --git a/services/real-time/package-lock.json b/services/real-time/package-lock.json index ba777f5d4c..85a0167a95 100644 --- a/services/real-time/package-lock.json +++ b/services/real-time/package-lock.json @@ -703,6 +703,11 @@ "ioredis": "~4.17.3" } }, + "@overleaf/settings": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@overleaf/settings/-/settings-2.1.1.tgz", + "integrity": "sha512-vcJwqCGFKmQxTP/syUqCeMaSRjHmBcQgKOACR9He2uJcErg2GZPa1go+nGvszMbkElM4HfRKm/MfxvqHhoN4TQ==" + }, "@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -5918,21 +5923,6 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" }, - "settings-sharelatex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/settings-sharelatex/-/settings-sharelatex-1.1.0.tgz", - "integrity": "sha512-f7D+0lnlohoteSn6IKTH72NE+JnAdMWTKwQglAuimZWTID2FRRItZSGeYMTRpvEnaQApkoVwRp//WRMsiddnqw==", - "requires": { - "coffee-script": "1.6.0" - }, - "dependencies": { - "coffee-script": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.0.tgz", - "integrity": "sha512-Tx8itEfCsQp8RbLDFt7qwjqXycAx2g6SI7//4PPUR2j6meLmNifYm6zKrNDcU1+Q/GWRhjhEZk7DaLG1TfIzGA==" - } - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", diff --git a/services/real-time/package.json b/services/real-time/package.json index f07ab3da62..37cd18f81f 100644 --- a/services/real-time/package.json +++ b/services/real-time/package.json @@ -24,6 +24,7 @@ "@overleaf/metrics": "^3.5.1", "@overleaf/o-error": "^3.1.0", "@overleaf/redis-wrapper": "^2.0.0", + "@overleaf/settings": "^2.1.1", "async": "^0.9.0", "base64id": "0.1.0", "basic-auth-connect": "^1.0.0", @@ -35,7 +36,6 @@ "express-session": "^1.17.1", "logger-sharelatex": "^2.2.0", "request": "^2.88.2", - "settings-sharelatex": "^1.1.0", "socket.io": "https://github.com/overleaf/socket.io/archive/0.9.19-overleaf-5.tar.gz", "socket.io-client": "https://github.com/overleaf/socket.io-client/archive/0.9.17-overleaf-3.tar.gz", "underscore": "1.13.1" diff --git a/services/real-time/test/acceptance/js/ApplyUpdateTests.js b/services/real-time/test/acceptance/js/ApplyUpdateTests.js index 14a8faa186..785afa3bf4 100644 --- a/services/real-time/test/acceptance/js/ApplyUpdateTests.js +++ b/services/real-time/test/acceptance/js/ApplyUpdateTests.js @@ -18,7 +18,7 @@ const { expect } = require('chai') const RealTimeClient = require('./helpers/RealTimeClient') const FixturesManager = require('./helpers/FixturesManager') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.documentupdater) diff --git a/services/real-time/test/acceptance/js/DrainManagerTests.js b/services/real-time/test/acceptance/js/DrainManagerTests.js index d312d34aa9..f4d5636adb 100644 --- a/services/real-time/test/acceptance/js/DrainManagerTests.js +++ b/services/real-time/test/acceptance/js/DrainManagerTests.js @@ -16,7 +16,7 @@ const { expect } = require('chai') const async = require('async') const request = require('request') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const drain = function (rate, callback) { request.post( diff --git a/services/real-time/test/acceptance/js/EarlyDisconnect.js b/services/real-time/test/acceptance/js/EarlyDisconnect.js index b6d360d0ea..cce2b318ec 100644 --- a/services/real-time/test/acceptance/js/EarlyDisconnect.js +++ b/services/real-time/test/acceptance/js/EarlyDisconnect.js @@ -18,7 +18,7 @@ const MockDocUpdaterServer = require('./helpers/MockDocUpdaterServer') const MockWebServer = require('./helpers/MockWebServer') const FixturesManager = require('./helpers/FixturesManager') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.pubsub) const rclientRT = redis.createClient(settings.redis.realtime) diff --git a/services/real-time/test/acceptance/js/LeaveProjectTests.js b/services/real-time/test/acceptance/js/LeaveProjectTests.js index 8364e25c4a..0d30c90c8f 100644 --- a/services/real-time/test/acceptance/js/LeaveProjectTests.js +++ b/services/real-time/test/acceptance/js/LeaveProjectTests.js @@ -17,7 +17,7 @@ const FixturesManager = require('./helpers/FixturesManager') const async = require('async') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.pubsub) diff --git a/services/real-time/test/acceptance/js/MatrixTests.js b/services/real-time/test/acceptance/js/MatrixTests.js index 9da735083e..ee7686679a 100644 --- a/services/real-time/test/acceptance/js/MatrixTests.js +++ b/services/real-time/test/acceptance/js/MatrixTests.js @@ -53,7 +53,7 @@ const async = require('async') const RealTimeClient = require('./helpers/RealTimeClient') const FixturesManager = require('./helpers/FixturesManager') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const Keys = settings.redis.documentupdater.key_schema const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.pubsub) diff --git a/services/real-time/test/acceptance/js/PubSubRace.js b/services/real-time/test/acceptance/js/PubSubRace.js index a331f73c1b..db97a3d00e 100644 --- a/services/real-time/test/acceptance/js/PubSubRace.js +++ b/services/real-time/test/acceptance/js/PubSubRace.js @@ -15,7 +15,7 @@ const FixturesManager = require('./helpers/FixturesManager') const async = require('async') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.pubsub) diff --git a/services/real-time/test/acceptance/js/ReceiveUpdateTests.js b/services/real-time/test/acceptance/js/ReceiveUpdateTests.js index ae7ab8ef55..92d29b014f 100644 --- a/services/real-time/test/acceptance/js/ReceiveUpdateTests.js +++ b/services/real-time/test/acceptance/js/ReceiveUpdateTests.js @@ -19,7 +19,7 @@ const FixturesManager = require('./helpers/FixturesManager') const async = require('async') -const settings = require('settings-sharelatex') +const settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(settings.redis.pubsub) diff --git a/services/real-time/test/acceptance/js/SessionSocketsTests.js b/services/real-time/test/acceptance/js/SessionSocketsTests.js index 45f62195e5..44835142ea 100644 --- a/services/real-time/test/acceptance/js/SessionSocketsTests.js +++ b/services/real-time/test/acceptance/js/SessionSocketsTests.js @@ -9,7 +9,7 @@ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ const RealTimeClient = require('./helpers/RealTimeClient') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const { expect } = require('chai') describe('SessionSockets', function () { diff --git a/services/real-time/test/acceptance/js/helpers/RealTimeClient.js b/services/real-time/test/acceptance/js/helpers/RealTimeClient.js index 03589e4fa0..d5e8b79343 100644 --- a/services/real-time/test/acceptance/js/helpers/RealTimeClient.js +++ b/services/real-time/test/acceptance/js/helpers/RealTimeClient.js @@ -17,7 +17,7 @@ const io = require('socket.io-client') const async = require('async') const request = require('request') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') const redis = require('@overleaf/redis-wrapper') const rclient = redis.createClient(Settings.redis.websessions) diff --git a/services/real-time/test/acceptance/js/helpers/RealtimeServer.js b/services/real-time/test/acceptance/js/helpers/RealtimeServer.js index 950c4b966d..ef1a85a2a5 100644 --- a/services/real-time/test/acceptance/js/helpers/RealtimeServer.js +++ b/services/real-time/test/acceptance/js/helpers/RealtimeServer.js @@ -14,7 +14,7 @@ */ const app = require('../../../../app') const logger = require('logger-sharelatex') -const Settings = require('settings-sharelatex') +const Settings = require('@overleaf/settings') module.exports = { running: false, diff --git a/services/real-time/test/unit/js/ChannelManagerTests.js b/services/real-time/test/unit/js/ChannelManagerTests.js index aad5ddbd42..a7d857dada 100644 --- a/services/real-time/test/unit/js/ChannelManagerTests.js +++ b/services/real-time/test/unit/js/ChannelManagerTests.js @@ -20,7 +20,7 @@ describe('ChannelManager', function () { this.other_rclient = {} return (this.ChannelManager = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': (this.settings = {}), + '@overleaf/settings': (this.settings = {}), '@overleaf/metrics': (this.metrics = { inc: sinon.stub(), summary: sinon.stub() diff --git a/services/real-time/test/unit/js/ConnectedUsersManagerTests.js b/services/real-time/test/unit/js/ConnectedUsersManagerTests.js index a0ab01631e..8525b94b02 100644 --- a/services/real-time/test/unit/js/ConnectedUsersManagerTests.js +++ b/services/real-time/test/unit/js/ConnectedUsersManagerTests.js @@ -56,7 +56,7 @@ describe('ConnectedUsersManager', function () { this.ConnectedUsersManager = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': this.settings, + '@overleaf/settings': this.settings, '@overleaf/redis-wrapper': { createClient: () => { return this.rClient diff --git a/services/real-time/test/unit/js/DocumentUpdaterControllerTests.js b/services/real-time/test/unit/js/DocumentUpdaterControllerTests.js index 8f0be7f87d..333fe53499 100644 --- a/services/real-time/test/unit/js/DocumentUpdaterControllerTests.js +++ b/services/real-time/test/unit/js/DocumentUpdaterControllerTests.js @@ -28,7 +28,7 @@ describe('DocumentUpdaterController', function () { this.RoomEvents = { on: sinon.stub() } this.EditorUpdatesController = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': (this.settings = { + '@overleaf/settings': (this.settings = { redis: { documentupdater: { key_schema: { diff --git a/services/real-time/test/unit/js/DocumentUpdaterManagerTests.js b/services/real-time/test/unit/js/DocumentUpdaterManagerTests.js index 94ef11f716..e2b6bdbe51 100644 --- a/services/real-time/test/unit/js/DocumentUpdaterManagerTests.js +++ b/services/real-time/test/unit/js/DocumentUpdaterManagerTests.js @@ -41,7 +41,7 @@ describe('DocumentUpdaterManager', function () { return (this.DocumentUpdaterManager = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': this.settings, + '@overleaf/settings': this.settings, request: (this.request = {}), '@overleaf/redis-wrapper': { createClient: () => this.rclient }, '@overleaf/metrics': (this.Metrics = { diff --git a/services/real-time/test/unit/js/RoomManagerTests.js b/services/real-time/test/unit/js/RoomManagerTests.js index fd22271469..b2cd2fe0e3 100644 --- a/services/real-time/test/unit/js/RoomManagerTests.js +++ b/services/real-time/test/unit/js/RoomManagerTests.js @@ -23,7 +23,7 @@ describe('RoomManager', function () { this.client = { namespace: { name: '' }, id: 'first-client' } this.RoomManager = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': (this.settings = {}), + '@overleaf/settings': (this.settings = {}), '@overleaf/metrics': (this.metrics = { gauge: sinon.stub() }) } }) diff --git a/services/real-time/test/unit/js/SafeJsonParseTest.js b/services/real-time/test/unit/js/SafeJsonParseTest.js index de50bccebb..bdbba00c93 100644 --- a/services/real-time/test/unit/js/SafeJsonParseTest.js +++ b/services/real-time/test/unit/js/SafeJsonParseTest.js @@ -19,7 +19,7 @@ describe('SafeJsonParse', function () { beforeEach(function () { return (this.SafeJsonParse = SandboxedModule.require(modulePath, { requires: { - 'settings-sharelatex': (this.Settings = { + '@overleaf/settings': (this.Settings = { maxUpdateSize: 16 * 1024 }) } diff --git a/services/real-time/test/unit/js/WebApiManagerTests.js b/services/real-time/test/unit/js/WebApiManagerTests.js index 97be3c27f0..b1291b4205 100644 --- a/services/real-time/test/unit/js/WebApiManagerTests.js +++ b/services/real-time/test/unit/js/WebApiManagerTests.js @@ -23,7 +23,7 @@ describe('WebApiManager', function () { return (this.WebApiManager = SandboxedModule.require(modulePath, { requires: { request: (this.request = {}), - 'settings-sharelatex': (this.settings = { + '@overleaf/settings': (this.settings = { apis: { web: { url: 'http://web.example.com',