[misc] switch from settings-sharelatex to @overleaf/settings

This commit is contained in:
Jakob Ackermann 2021-07-12 17:47:18 +01:00
parent 7af2c6a5ea
commit a26ae73597
30 changed files with 34 additions and 44 deletions

View file

@ -1,5 +1,5 @@
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
Metrics.initialize(Settings.appName || 'real-time') Metrics.initialize(Settings.appName || 'real-time')
const async = require('async') const async = require('async')

View file

@ -1,6 +1,6 @@
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const ClientMap = new Map() // for each redis client, store a Map of subscribed channels (channelname -> subscribe promise) const ClientMap = new Map() // for each redis client, store a Map of subscribed channels (channelname -> subscribe promise)

View file

@ -2,7 +2,7 @@
camelcase, camelcase,
*/ */
const async = require('async') const async = require('async')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')

View file

@ -1,5 +1,5 @@
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const fs = require('fs') const fs = require('fs')
// Monitor a status file (e.g. /etc/real_time_status) periodically and close the // Monitor a status file (e.g. /etc/real_time_status) periodically and close the

View file

@ -2,7 +2,7 @@
camelcase, camelcase,
*/ */
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const RedisClientManager = require('./RedisClientManager') const RedisClientManager = require('./RedisClientManager')
const SafeJsonParse = require('./SafeJsonParse') const SafeJsonParse = require('./SafeJsonParse')
const EventLogger = require('./EventLogger') const EventLogger = require('./EventLogger')

View file

@ -5,7 +5,7 @@ const request = require('request')
const _ = require('underscore') const _ = require('underscore')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const { const {
ClientRequestedMissingOpsError, ClientRequestedMissingOpsError,

View file

@ -4,7 +4,7 @@
let EventLogger let EventLogger
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const metrics = require('@overleaf/metrics') 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 // keep track of message counters to detect duplicate and out of order events
// messsage ids have the format "UNIQUEHOSTKEY-COUNTER" // messsage ids have the format "UNIQUEHOSTKEY-COUNTER"

View file

@ -3,7 +3,7 @@
*/ */
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const WebsocketController = require('./WebsocketController') const WebsocketController = require('./WebsocketController')
const HttpController = require('./HttpController') const HttpController = require('./HttpController')
const HttpApiController = require('./HttpApiController') const HttpApiController = require('./HttpApiController')

View file

@ -1,4 +1,4 @@
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const { DataTooLargeToParseError } = require('./Errors') const { DataTooLargeToParseError } = require('./Errors')
module.exports = { module.exports = {

View file

@ -3,7 +3,7 @@
*/ */
const request = require('request') const request = require('request')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const { const {
CodedError, CodedError,

View file

@ -1,7 +1,7 @@
/* eslint-disable /* eslint-disable
camelcase, camelcase,
*/ */
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const RedisClientManager = require('./RedisClientManager') const RedisClientManager = require('./RedisClientManager')
const SafeJsonParse = require('./SafeJsonParse') const SafeJsonParse = require('./SafeJsonParse')

View file

@ -703,6 +703,11 @@
"ioredis": "~4.17.3" "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": { "@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "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", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" "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": { "shebang-command": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",

View file

@ -24,6 +24,7 @@
"@overleaf/metrics": "^3.5.1", "@overleaf/metrics": "^3.5.1",
"@overleaf/o-error": "^3.1.0", "@overleaf/o-error": "^3.1.0",
"@overleaf/redis-wrapper": "^2.0.0", "@overleaf/redis-wrapper": "^2.0.0",
"@overleaf/settings": "^2.1.1",
"async": "^0.9.0", "async": "^0.9.0",
"base64id": "0.1.0", "base64id": "0.1.0",
"basic-auth-connect": "^1.0.0", "basic-auth-connect": "^1.0.0",
@ -35,7 +36,6 @@
"express-session": "^1.17.1", "express-session": "^1.17.1",
"logger-sharelatex": "^2.2.0", "logger-sharelatex": "^2.2.0",
"request": "^2.88.2", "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": "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", "socket.io-client": "https://github.com/overleaf/socket.io-client/archive/0.9.17-overleaf-3.tar.gz",
"underscore": "1.13.1" "underscore": "1.13.1"

View file

@ -18,7 +18,7 @@ const { expect } = require('chai')
const RealTimeClient = require('./helpers/RealTimeClient') const RealTimeClient = require('./helpers/RealTimeClient')
const FixturesManager = require('./helpers/FixturesManager') const FixturesManager = require('./helpers/FixturesManager')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.documentupdater) const rclient = redis.createClient(settings.redis.documentupdater)

View file

@ -16,7 +16,7 @@ const { expect } = require('chai')
const async = require('async') const async = require('async')
const request = require('request') const request = require('request')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const drain = function (rate, callback) { const drain = function (rate, callback) {
request.post( request.post(

View file

@ -18,7 +18,7 @@ const MockDocUpdaterServer = require('./helpers/MockDocUpdaterServer')
const MockWebServer = require('./helpers/MockWebServer') const MockWebServer = require('./helpers/MockWebServer')
const FixturesManager = require('./helpers/FixturesManager') const FixturesManager = require('./helpers/FixturesManager')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.pubsub) const rclient = redis.createClient(settings.redis.pubsub)
const rclientRT = redis.createClient(settings.redis.realtime) const rclientRT = redis.createClient(settings.redis.realtime)

View file

@ -17,7 +17,7 @@ const FixturesManager = require('./helpers/FixturesManager')
const async = require('async') const async = require('async')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.pubsub) const rclient = redis.createClient(settings.redis.pubsub)

View file

@ -53,7 +53,7 @@ const async = require('async')
const RealTimeClient = require('./helpers/RealTimeClient') const RealTimeClient = require('./helpers/RealTimeClient')
const FixturesManager = require('./helpers/FixturesManager') const FixturesManager = require('./helpers/FixturesManager')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const Keys = settings.redis.documentupdater.key_schema const Keys = settings.redis.documentupdater.key_schema
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.pubsub) const rclient = redis.createClient(settings.redis.pubsub)

View file

@ -15,7 +15,7 @@ const FixturesManager = require('./helpers/FixturesManager')
const async = require('async') const async = require('async')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.pubsub) const rclient = redis.createClient(settings.redis.pubsub)

View file

@ -19,7 +19,7 @@ const FixturesManager = require('./helpers/FixturesManager')
const async = require('async') const async = require('async')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(settings.redis.pubsub) const rclient = redis.createClient(settings.redis.pubsub)

View file

@ -9,7 +9,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const RealTimeClient = require('./helpers/RealTimeClient') const RealTimeClient = require('./helpers/RealTimeClient')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const { expect } = require('chai') const { expect } = require('chai')
describe('SessionSockets', function () { describe('SessionSockets', function () {

View file

@ -17,7 +17,7 @@ const io = require('socket.io-client')
const async = require('async') const async = require('async')
const request = require('request') const request = require('request')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const redis = require('@overleaf/redis-wrapper') const redis = require('@overleaf/redis-wrapper')
const rclient = redis.createClient(Settings.redis.websessions) const rclient = redis.createClient(Settings.redis.websessions)

View file

@ -14,7 +14,7 @@
*/ */
const app = require('../../../../app') const app = require('../../../../app')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
module.exports = { module.exports = {
running: false, running: false,

View file

@ -20,7 +20,7 @@ describe('ChannelManager', function () {
this.other_rclient = {} this.other_rclient = {}
return (this.ChannelManager = SandboxedModule.require(modulePath, { return (this.ChannelManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': (this.settings = {}), '@overleaf/settings': (this.settings = {}),
'@overleaf/metrics': (this.metrics = { '@overleaf/metrics': (this.metrics = {
inc: sinon.stub(), inc: sinon.stub(),
summary: sinon.stub() summary: sinon.stub()

View file

@ -56,7 +56,7 @@ describe('ConnectedUsersManager', function () {
this.ConnectedUsersManager = SandboxedModule.require(modulePath, { this.ConnectedUsersManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': this.settings, '@overleaf/settings': this.settings,
'@overleaf/redis-wrapper': { '@overleaf/redis-wrapper': {
createClient: () => { createClient: () => {
return this.rClient return this.rClient

View file

@ -28,7 +28,7 @@ describe('DocumentUpdaterController', function () {
this.RoomEvents = { on: sinon.stub() } this.RoomEvents = { on: sinon.stub() }
this.EditorUpdatesController = SandboxedModule.require(modulePath, { this.EditorUpdatesController = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': (this.settings = { '@overleaf/settings': (this.settings = {
redis: { redis: {
documentupdater: { documentupdater: {
key_schema: { key_schema: {

View file

@ -41,7 +41,7 @@ describe('DocumentUpdaterManager', function () {
return (this.DocumentUpdaterManager = SandboxedModule.require(modulePath, { return (this.DocumentUpdaterManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': this.settings, '@overleaf/settings': this.settings,
request: (this.request = {}), request: (this.request = {}),
'@overleaf/redis-wrapper': { createClient: () => this.rclient }, '@overleaf/redis-wrapper': { createClient: () => this.rclient },
'@overleaf/metrics': (this.Metrics = { '@overleaf/metrics': (this.Metrics = {

View file

@ -23,7 +23,7 @@ describe('RoomManager', function () {
this.client = { namespace: { name: '' }, id: 'first-client' } this.client = { namespace: { name: '' }, id: 'first-client' }
this.RoomManager = SandboxedModule.require(modulePath, { this.RoomManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': (this.settings = {}), '@overleaf/settings': (this.settings = {}),
'@overleaf/metrics': (this.metrics = { gauge: sinon.stub() }) '@overleaf/metrics': (this.metrics = { gauge: sinon.stub() })
} }
}) })

View file

@ -19,7 +19,7 @@ describe('SafeJsonParse', function () {
beforeEach(function () { beforeEach(function () {
return (this.SafeJsonParse = SandboxedModule.require(modulePath, { return (this.SafeJsonParse = SandboxedModule.require(modulePath, {
requires: { requires: {
'settings-sharelatex': (this.Settings = { '@overleaf/settings': (this.Settings = {
maxUpdateSize: 16 * 1024 maxUpdateSize: 16 * 1024
}) })
} }

View file

@ -23,7 +23,7 @@ describe('WebApiManager', function () {
return (this.WebApiManager = SandboxedModule.require(modulePath, { return (this.WebApiManager = SandboxedModule.require(modulePath, {
requires: { requires: {
request: (this.request = {}), request: (this.request = {}),
'settings-sharelatex': (this.settings = { '@overleaf/settings': (this.settings = {
apis: { apis: {
web: { web: {
url: 'http://web.example.com', url: 'http://web.example.com',