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

This commit is contained in:
Jakob Ackermann 2021-07-12 17:47:21 +01:00
parent ec49c4c9a6
commit 64551f0198
37 changed files with 41 additions and 49 deletions

View file

@ -11,7 +11,7 @@ Metrics.initialize('clsi')
const CompileController = require('./app/js/CompileController')
const ContentController = require('./app/js/ContentController')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
logger.initialize('clsi')
if ((Settings.sentry != null ? Settings.sentry.dsn : undefined) != null) {

View file

@ -6,7 +6,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let commandRunnerPath
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
if ((Settings.clsi != null ? Settings.clsi.dockerRunner : undefined) === true) {

View file

@ -15,7 +15,7 @@
let CompileController
const RequestParser = require('./RequestParser')
const CompileManager = require('./CompileManager')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const Metrics = require('./Metrics')
const ProjectPersistenceManager = require('./ProjectPersistenceManager')
const logger = require('logger-sharelatex')

View file

@ -20,7 +20,7 @@ const ResourceWriter = require('./ResourceWriter')
const LatexRunner = require('./LatexRunner')
const OutputFileFinder = require('./OutputFileFinder')
const OutputCacheManager = require('./OutputCacheManager')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const Path = require('path')
const logger = require('logger-sharelatex')
const Metrics = require('./Metrics')

View file

@ -6,7 +6,7 @@ const { callbackify } = require('util')
const fs = require('fs')
const crypto = require('crypto')
const Path = require('path')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error')
const pLimit = require('p-limit')
const { parseXrefTable } = require('../lib/pdfjs/parseXrefTable')

View file

@ -1,6 +1,6 @@
const Path = require('path')
const send = require('send')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const OutputCacheManager = require('./OutputCacheManager')
const ONE_DAY_S = 24 * 60 * 60

View file

@ -6,7 +6,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const async = require('async')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
const queue = async.queue(
(task, cb) => task(cb),

View file

@ -1,4 +1,4 @@
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
const Docker = require('dockerode')
const dockerode = new Docker()

View file

@ -15,7 +15,7 @@
*/
let LatexRunner
const Path = require('path')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
const Metrics = require('./Metrics')
const CommandRunner = require('./CommandRunner')

View file

@ -12,7 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let LockManager
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
const Lockfile = require('lockfile') // from https://github.com/npm/lockfile
const Errors = require('./Errors')

View file

@ -20,7 +20,7 @@ const fse = require('fs-extra')
const Path = require('path')
const logger = require('logger-sharelatex')
const _ = require('lodash')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const crypto = require('crypto')
const Metrics = require('./Metrics')

View file

@ -20,7 +20,7 @@ const dbQueue = require('./DbQueue')
const async = require('async')
const logger = require('logger-sharelatex')
const oneDay = 24 * 60 * 60 * 1000
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const diskusage = require('diskusage')
const { callbackify } = require('util')

View file

@ -18,7 +18,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let RequestParser
const settings = require('settings-sharelatex')
const settings = require('@overleaf/settings')
module.exports = RequestParser = {
VALID_COMPILERS: ['pdflatex', 'latex', 'xelatex', 'lualatex'],

View file

@ -23,7 +23,7 @@ const OutputFileFinder = require('./OutputFileFinder')
const ResourceStateManager = require('./ResourceStateManager')
const Metrics = require('./Metrics')
const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex')
const settings = require('@overleaf/settings')
const parallelFileDownloads = settings.parallelFileDownloads || 1

View file

@ -17,7 +17,7 @@
let ForbidSymlinks
const Path = require('path')
const fs = require('fs')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const logger = require('logger-sharelatex')
const url = require('url')

View file

@ -16,7 +16,7 @@ let UrlCache
const db = require('./db')
const dbQueue = require('./DbQueue')
const UrlFetcher = require('./UrlFetcher')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const crypto = require('crypto')
const fs = require('fs')
const logger = require('logger-sharelatex')

View file

@ -16,7 +16,7 @@ let UrlFetcher
const request = require('request').defaults({ jar: false })
const fs = require('fs')
const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex')
const settings = require('@overleaf/settings')
const URL = require('url')
const async = require('async')

View file

@ -9,7 +9,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const Sequelize = require('sequelize')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const _ = require('lodash')
const logger = require('logger-sharelatex')

View file

@ -1022,6 +1022,11 @@
}
}
},
"@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",
@ -2065,11 +2070,6 @@
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
},
"coffee-script": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.0.tgz",
"integrity": "sha1-gIs5bhEPU9AhoZpO8fZb4OjjX6M="
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
@ -7047,14 +7047,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"
}
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",

View file

@ -21,6 +21,7 @@
"dependencies": {
"@overleaf/metrics": "^3.5.1",
"@overleaf/o-error": "^3.3.1",
"@overleaf/settings": "^2.1.1",
"async": "3.2.0",
"body-parser": "^1.19.0",
"bunyan": "^1.8.15",
@ -38,7 +39,6 @@
"request": "^2.88.2",
"send": "^0.17.1",
"sequelize": "^5.21.5",
"settings-sharelatex": "^1.1.0",
"sqlite3": "^4.1.1",
"v8-profiler-node8": "^6.1.1",
"wrench": "~1.5.9"

View file

@ -1,5 +1,5 @@
const request = require('request')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
after(function (done) {
request(
{

View file

@ -15,7 +15,7 @@
let Client
const request = require('request')
const fs = require('fs')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const host = 'localhost'

View file

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

View file

@ -10,7 +10,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const request = require('request')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const async = require('async')
const fs = require('fs')
const _ = require('lodash')

View file

@ -1,5 +1,5 @@
const request = require('request')
const Settings = require('settings-sharelatex')
const Settings = require('@overleaf/settings')
const buildUrl = (path) =>
`http://${Settings.internal.clsi.host}:${Settings.internal.clsi.port}/${path}`

View file

@ -66,7 +66,7 @@ describe('CompileController', function () {
requires: {
'./CompileManager': (this.CompileManager = {}),
'./RequestParser': (this.RequestParser = {}),
'settings-sharelatex': (this.Settings = {
'@overleaf/settings': (this.Settings = {
apis: {
clsi: {
url: 'http://clsi.example.com'

View file

@ -31,7 +31,7 @@ describe('CompileManager', function () {
'./ResourceWriter': (this.ResourceWriter = {}),
'./OutputFileFinder': (this.OutputFileFinder = {}),
'./OutputCacheManager': (this.OutputCacheManager = {}),
'settings-sharelatex': (this.Settings = {
'@overleaf/settings': (this.Settings = {
path: {
compilesDir: '/compiles/dir',
outputDir: '/output/dir'

View file

@ -8,7 +8,7 @@ describe('ContentCacheManager', function () {
let contentDir, pdfPath
let ContentCacheManager, files, Settings
before(function () {
Settings = require('settings-sharelatex')
Settings = require('@overleaf/settings')
ContentCacheManager = require(MODULE_PATH)
})
let contentRanges, newContentRanges, reclaimed

View file

@ -20,7 +20,7 @@ describe('LockManager', function () {
beforeEach(function () {
return (this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': (this.Settings = { clsi: { docker: {} } })
'@overleaf/settings': (this.Settings = { clsi: { docker: {} } })
}
}))
})

View file

@ -28,7 +28,7 @@ describe('DockerRunner', function () {
this.container = container = {}
this.DockerRunner = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': (this.Settings = {
'@overleaf/settings': (this.Settings = {
clsi: { docker: {} },
path: {}
}),

View file

@ -23,7 +23,7 @@ describe('LatexRunner', function () {
let Timer
this.LatexRunner = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': (this.Settings = {
'@overleaf/settings': (this.Settings = {
docker: {
socketPath: '/var/run/docker.sock'
}

View file

@ -22,7 +22,7 @@ describe('DockerLockManager', function () {
beforeEach(function () {
this.LockManager = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': {},
'@overleaf/settings': {},
fs: {
lstat: sinon.stub().callsArgWith(1),
readdir: sinon.stub().callsArgWith(1)

View file

@ -27,7 +27,7 @@ describe('ProjectPersistenceManager', function () {
'./UrlCache': (this.UrlCache = {}),
'./CompileManager': (this.CompileManager = {}),
diskusage: (this.diskusage = { check: sinon.stub() }),
'settings-sharelatex': (this.settings = {
'@overleaf/settings': (this.settings = {
project_cache_length_ms: 1000,
path: {
compilesDir: '/compiles',

View file

@ -40,7 +40,7 @@ describe('RequestParser', function () {
}
return (this.RequestParser = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': (this.settings = {})
'@overleaf/settings': (this.settings = {})
}
}))
})

View file

@ -30,7 +30,7 @@ describe('StaticServerForbidSymlinks', function () {
this.fs = {}
this.ForbidSymlinks = SandboxedModule.require(modulePath, {
requires: {
'settings-sharelatex': this.settings,
'@overleaf/settings': this.settings,
fs: this.fs
}
})

View file

@ -24,7 +24,7 @@ describe('UrlCache', function () {
requires: {
'./db': {},
'./UrlFetcher': (this.UrlFetcher = {}),
'settings-sharelatex': (this.Settings = {
'@overleaf/settings': (this.Settings = {
path: { clsiCacheDir: '/cache/dir' }
}),
fs: (this.fs = { copyFile: sinon.stub().yields() })

View file

@ -24,7 +24,7 @@ describe('UrlFetcher', function () {
defaults: (this.defaults = sinon.stub().returns((this.request = {})))
},
fs: (this.fs = {}),
'settings-sharelatex': (this.settings = {
'@overleaf/settings': (this.settings = {
apis: {
clsiPerf: {
host: 'localhost:3043'