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

This commit is contained in:
Jakob Ackermann 2021-07-12 17:47:16 +01:00
parent 7495d2114a
commit b5bb7c3b04
29 changed files with 33 additions and 43 deletions

View file

@ -7,7 +7,7 @@
*/ */
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
Metrics.initialize('track-changes') Metrics.initialize('track-changes')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const TrackChangesLogger = logger.initialize('track-changes').logger const TrackChangesLogger = logger.initialize('track-changes').logger

View file

@ -14,7 +14,7 @@
let DocumentUpdaterManager let DocumentUpdaterManager
const request = require('request') const request = require('request')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
module.exports = DocumentUpdaterManager = { module.exports = DocumentUpdaterManager = {
getDocument(project_id, doc_id, callback) { getDocument(project_id, doc_id, callback) {

View file

@ -13,7 +13,7 @@
const { ObjectId } = require('./mongodb') const { ObjectId } = require('./mongodb')
const request = require('request') const request = require('request')
const async = require('async') const async = require('async')
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const { port } = settings.internal.trackchanges const { port } = settings.internal.trackchanges
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const LockManager = require('./LockManager') const LockManager = require('./LockManager')

View file

@ -10,7 +10,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
*/ */
let LockManager let LockManager
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.lock) const rclient = redis.createClient(Settings.redis.lock)
const os = require('os') const os = require('os')

View file

@ -14,7 +14,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
*/ */
let MongoAWS let MongoAWS
const settings = require('settings-sharelatex') const settings = require('@overleaf/settings')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const AWS = require('aws-sdk') const AWS = require('aws-sdk')
const S3S = require('s3-streams') const S3S = require('s3-streams')

View file

@ -24,7 +24,7 @@ const LockManager = require('./LockManager')
const MongoAWS = require('./MongoAWS') const MongoAWS = require('./MongoAWS')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const ProjectIterator = require('./ProjectIterator') const ProjectIterator = require('./ProjectIterator')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const keys = Settings.redis.lock.key_schema const keys = Settings.redis.lock.key_schema
// Sharejs operations are stored in a 'pack' object // Sharejs operations are stored in a 'pack' object

View file

@ -16,7 +16,7 @@
let LIMIT, pending let LIMIT, pending
let project_id, doc_id let project_id, doc_id
const { callbackify } = require('util') const { callbackify } = require('util')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const async = require('async') const async = require('async')
const _ = require('underscore') const _ = require('underscore')
const { db, ObjectId, waitForDb, closeDb } = require('./mongodb') const { db, ObjectId, waitForDb, closeDb } = require('./mongodb')

View file

@ -13,7 +13,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
*/ */
let RedisManager let RedisManager
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.history) const rclient = redis.createClient(Settings.redis.history)
const Keys = Settings.redis.history.key_schema const Keys = Settings.redis.history.key_schema

View file

@ -25,7 +25,7 @@ const UpdateTrimmer = require('./UpdateTrimmer')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const async = require('async') const async = require('async')
const _ = require('underscore') const _ = require('underscore')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const keys = Settings.redis.lock.key_schema const keys = Settings.redis.lock.key_schema
module.exports = UpdatesManager = { module.exports = UpdatesManager = {

View file

@ -13,7 +13,7 @@
let WebApiManager let WebApiManager
const request = require('requestretry') // allow retry on error https://github.com/FGRibreau/node-request-retry const request = require('requestretry') // allow retry on error https://github.com/FGRibreau/node-request-retry
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
// Don't let HTTP calls hang for a long time // Don't let HTTP calls hang for a long time
const MAX_HTTP_REQUEST_LENGTH = 15000 // 15 seconds const MAX_HTTP_REQUEST_LENGTH = 15000 // 15 seconds

View file

@ -1,4 +1,4 @@
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const { MongoClient, ObjectId } = require('mongodb') const { MongoClient, ObjectId } = require('mongodb')
const clientPromise = MongoClient.connect( const clientPromise = MongoClient.connect(

View file

@ -980,6 +980,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",
@ -6431,21 +6436,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

@ -21,6 +21,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",
"JSONStream": "^1.3.5", "JSONStream": "^1.3.5",
"async": "^2.6.3", "async": "^2.6.3",
"aws-sdk": "^2.643.0", "aws-sdk": "^2.643.0",
@ -38,7 +39,6 @@
"request": "~2.88.2", "request": "~2.88.2",
"requestretry": "^4.1.0", "requestretry": "^4.1.0",
"s3-streams": "^0.4.0", "s3-streams": "^0.4.0",
"settings-sharelatex": "^1.1.0",
"underscore": "~1.13.1" "underscore": "~1.13.1"
}, },
"devDependencies": { "devDependencies": {

View file

@ -13,7 +13,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('../../../app/js/mongodb') const { ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const request = require('request') const request = require('request')
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now

View file

@ -17,7 +17,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { db, ObjectId } = require('../../../app/js/mongodb') const { db, ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const request = require('request') const request = require('request')
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now

View file

@ -13,7 +13,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('../../../app/js/mongodb') const { ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const request = require('request') const request = require('request')
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now

View file

@ -12,7 +12,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('../../../app/js/mongodb') const { ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const TrackChangesApp = require('./helpers/TrackChangesApp') const TrackChangesApp = require('./helpers/TrackChangesApp')
const TrackChangesClient = require('./helpers/TrackChangesClient') const TrackChangesClient = require('./helpers/TrackChangesClient')

View file

@ -13,7 +13,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('../../../app/js/mongodb') const { ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const TrackChangesApp = require('./helpers/TrackChangesApp') const TrackChangesApp = require('./helpers/TrackChangesApp')
const TrackChangesClient = require('./helpers/TrackChangesClient') const TrackChangesClient = require('./helpers/TrackChangesClient')

View file

@ -11,7 +11,7 @@
*/ */
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const LockManager = require('../../../app/js/LockManager') const LockManager = require('../../../app/js/LockManager')
const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now const rclient = require('redis').createClient(Settings.redis.history) // Only works locally for now
const TrackChangesApp = require('./helpers/TrackChangesApp') const TrackChangesApp = require('./helpers/TrackChangesApp')

View file

@ -12,7 +12,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('../../../app/js/mongodb') const { ObjectId } = require('../../../app/js/mongodb')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const TrackChangesApp = require('./helpers/TrackChangesApp') const TrackChangesApp = require('./helpers/TrackChangesApp')
const TrackChangesClient = require('./helpers/TrackChangesClient') const TrackChangesClient = require('./helpers/TrackChangesClient')

View file

@ -15,7 +15,7 @@
const app = require('../../../../app') const app = require('../../../../app')
const { waitForDb } = require('../../../../app/js/mongodb') const { waitForDb } = require('../../../../app/js/mongodb')
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

@ -16,7 +16,7 @@ let TrackChangesClient
const async = require('async') const async = require('async')
const zlib = require('zlib') const zlib = require('zlib')
const request = require('request') const request = require('request')
const Settings = require('settings-sharelatex') const Settings = require('@overleaf/settings')
const rclient = require('@overleaf/redis-wrapper').createClient( const rclient = require('@overleaf/redis-wrapper').createClient(
Settings.redis.history Settings.redis.history
) // Only works locally for now ) // Only works locally for now

View file

@ -21,7 +21,7 @@ describe('MongoAWS', function () {
this.MongoAWS = SandboxedModule.require(modulePath, { this.MongoAWS = SandboxedModule.require(modulePath, {
singleOnly: true, singleOnly: true,
requires: { requires: {
'settings-sharelatex': (this.settings = { '@overleaf/settings': (this.settings = {
trackchanges: { trackchanges: {
s3: { s3: {
secret: 's3-secret', secret: 's3-secret',

View file

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

View file

@ -34,7 +34,7 @@ describe('LockManager', function () {
return (this.rclient = { auth: sinon.stub() }) return (this.rclient = { auth: sinon.stub() })
} }
}, },
'settings-sharelatex': this.Settings '@overleaf/settings': this.Settings
} }
}) })

View file

@ -30,7 +30,7 @@ describe('PackManager', function () {
'./MongoAWS': {}, './MongoAWS': {},
'@overleaf/metrics': { inc() {} }, '@overleaf/metrics': { inc() {} },
'./ProjectIterator': require('../../../../app/js/ProjectIterator.js'), // Cache for speed './ProjectIterator': require('../../../../app/js/ProjectIterator.js'), // Cache for speed
'settings-sharelatex': { '@overleaf/settings': {
redis: { lock: { key_schema: {} } } redis: { lock: { key_schema: {} } }
} }
} }

View file

@ -28,7 +28,7 @@ describe('RedisManager', function () {
}) })
} }
}, },
'settings-sharelatex': { '@overleaf/settings': {
redis: { redis: {
history: { history: {
key_schema: { key_schema: {

View file

@ -32,7 +32,7 @@ describe('UpdatesManager', function () {
'./WebApiManager': (this.WebApiManager = {}), './WebApiManager': (this.WebApiManager = {}),
'./UpdateTrimmer': (this.UpdateTrimmer = {}), './UpdateTrimmer': (this.UpdateTrimmer = {}),
'./DocArchiveManager': (this.DocArchiveManager = {}), './DocArchiveManager': (this.DocArchiveManager = {}),
'settings-sharelatex': { '@overleaf/settings': {
redis: { redis: {
lock: { lock: {
key_schema: { key_schema: {

View file

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