Merge pull request #4296 from overleaf/jpa-cleanup-config

[config] minor cleanup

GitOrigin-RevId: 72f39e88cb91c7ed7305ade6dc46f63d7bf43ce9
This commit is contained in:
Jakob Ackermann 2021-07-07 11:39:09 +02:00 committed by Copybot
parent 5e773ce950
commit fa39ef7fe5
2 changed files with 11 additions and 33 deletions

View file

@ -1,4 +1,4 @@
let defaultFeatures, docUpdaterPort, siteUrl, v1Api
let defaultFeatures, siteUrl
const http = require('http')
http.globalAgent.maxSockets = 300
@ -17,20 +17,6 @@ if (httpAuthUser && httpAuthPass) {
const sessionSecret = process.env.SESSION_SECRET || 'secret-please-change'
if (process.env.V1_API_URL || process.env.V1_HOST) {
v1Api = {
url: process.env.V1_API_URL || `http://${process.env.V1_HOST}:5000`,
user: process.env.V1_API_USER,
pass: process.env.V1_API_PASSWORD,
}
} else {
v1Api = {
url: undefined,
user: undefined,
pass: undefined,
}
}
const intFromEnv = function (name, defaultValue) {
if (
[null, undefined].includes(defaultValue) ||
@ -174,9 +160,6 @@ module.exports = {
port: process.env.WEB_PORT || 3000,
host: process.env.LISTEN_ADDRESS || 'localhost',
},
documentupdater: {
port: (docUpdaterPort = 3003),
},
},
gitBridgePublicBaseUrl: `http://${
@ -199,16 +182,13 @@ module.exports = {
process.env.DOCUPDATER_HOST ||
process.env.DOCUMENT_UPDATER_HOST ||
'localhost'
}:${docUpdaterPort}`,
}:3003`,
},
thirdPartyDataStore: {
url: `http://${process.env.TPDS_HOST || 'localhost'}:3002`,
emptyProjectFlushDelayMiliseconds: 5 * seconds,
dropboxApp: process.env.TPDS_DROPBOX_APP,
},
tags: {
url: `http://${process.env.TAGS_HOST || 'localhost'}:3012`,
},
spelling: {
url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
host: process.env.SPELLING_HOST,
@ -300,9 +280,12 @@ module.exports = {
),
},
v1: {
url: v1Api.url,
user: v1Api.user,
pass: v1Api.pass,
url:
process.env.V1_API_URL || process.env.V1_HOST
? process.env.V1_API_URL || `http://${process.env.V1_HOST}:5000`
: undefined,
user: process.env.V1_API_USER || undefined,
pass: process.env.V1_API_PASSWORD || undefined,
},
v1_history: {
url: `http://${process.env.V1_HISTORY_HOST || 'localhost'}:3100/api`,
@ -402,9 +385,6 @@ module.exports = {
// this is only used if cookies are used for clsi backend
// clsiCookieKey: "clsiserver"
// Same, but with http auth credentials.
httpAuthSiteUrl: `http://${httpAuthUser}:${httpAuthPass}@${siteUrl}`,
robotsNoindex: process.env.ROBOTS_NOINDEX === 'true' || false,
maxEntitiesPerProject: 2000,
@ -713,7 +693,9 @@ module.exports = {
appName: process.env.APP_NAME || 'ShareLaTeX (Community Edition)',
adminEmail: process.env.ADMIN_EMAIL || 'placeholder@example.com',
adminDomains: JSON.parse(process.env.ADMIN_DOMAINS || 'null'),
adminDomains: process.env.ADMIN_DOMAINS
? JSON.parse(process.env.ADMIN_DOMAINS)
: undefined,
salesEmail: process.env.SALES_EMAIL || 'placeholder@example.com',

View file

@ -15,10 +15,7 @@ const collaberatorRef = ObjectId()
const projectName = 'project_name_here'
const thirdPartyDataStoreApiUrl = 'http://third-party-json-store.herokuapp.com'
const httpUsername = 'user'
const httpPass = 'pass'
const siteUrl = 'http://www.localhost:3000'
const httpAuthSiteUrl = `http://${httpUsername}:${httpPass}@www.localhost:3000`
const filestoreUrl = 'filestore.sharelatex.com'
const projectArchiverUrl = 'project-archiver.overleaf.com'
@ -38,7 +35,6 @@ describe('TpdsUpdateSender', function () {
this.request = sinon.stub().resolves()
this.settings = {
siteUrl,
httpAuthSiteUrl,
apis: {
thirdPartyDataStore: { url: thirdPartyDataStoreApiUrl },
filestore: {