Merge pull request #18116 from overleaf/jpa-bulk-replace-localhost

[misc] bulk replace localhost with 127.0.0.1

GitOrigin-RevId: d238f3635302e8ff5500d611108c4d1bef216726
This commit is contained in:
Jakob Ackermann 2024-04-25 13:56:00 +01:00 committed by Copybot
parent 90a02ebc2f
commit a540754f6e
74 changed files with 236 additions and 236 deletions

View File

@ -18,7 +18,7 @@ describe('fetch-utils', function () {
before(async function () {
this.server = new TestServer()
await this.server.start(PORT)
this.url = path => `http://localhost:${PORT}${path}`
this.url = path => `http://127.0.0.1:${PORT}${path}`
})
after(async function () {

View File

@ -4,7 +4,7 @@
const redis = require('../../')
const logger = require('@overleaf/logger')
const rclient = redis.createClient({ host: 'localhost', port: '6379' })
const rclient = redis.createClient({ host: '127.0.0.1', port: '6379' })
setInterval(() => {
rclient.healthCheck(err => {

View File

@ -1,14 +1,14 @@
module.exports = {
internal: {
chat: {
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
port: 3010,
},
},
apis: {
web: {
url: `http://${process.env.WEB_HOST || 'localhost'}:${
url: `http://${process.env.WEB_HOST || '127.0.0.1'}:${
process.env.WEB_PORT || 3000
}`,
user: process.env.WEB_API_USER || 'overleaf',
@ -19,7 +19,7 @@ module.exports = {
mongo: {
url:
process.env.MONGO_CONNECTION_STRING ||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
`mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
options: {
monitorCommands: true,
},

View File

@ -9,7 +9,7 @@ export async function ensureRunning() {
if (!serverPromise) {
const { app } = await createServer()
const startServer = promisify(app.listen.bind(app))
serverPromise = startServer(3010, 'localhost')
serverPromise = startServer(3010, '127.0.0.1')
}
return serverPromise
}

View File

@ -1,7 +1,7 @@
import Request from 'request'
const request = Request.defaults({
baseUrl: 'http://localhost:3010',
baseUrl: 'http://127.0.0.1:3010',
})
async function asyncRequest(options) {

View File

@ -23,7 +23,7 @@ module.exports = {
internal: {
clsi: {
port: 3013,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
load_balancer_agent: {
@ -35,12 +35,12 @@ module.exports = {
apis: {
clsi: {
// Internal requests (used by tests only at the time of writing).
url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
// External url prefix for output files, e.g. for requests via load-balancers.
outputUrlPrefix: `${process.env.ZONE ? `/zone/${process.env.ZONE}` : ''}`,
},
clsiPerf: {
host: `${process.env.CLSI_PERF_HOST || 'localhost'}:${
host: `${process.env.CLSI_PERF_HOST || '127.0.0.1'}:${
process.env.CLSI_PERF_PORT || '3043'
}`,
},

View File

@ -72,7 +72,7 @@ module.exports = Client = {
done(new Error('error starting server: ' + error.message))
} else {
const addr = server.address()
Settings.filestoreDomainOveride = `http://localhost:${addr.port}`
Settings.filestoreDomainOveride = `http://127.0.0.1:${addr.port}`
done()
}
})

View File

@ -5,14 +5,14 @@ module.exports = {
internal: {
contacts: {
port: 3036,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
mongo: {
url:
process.env.MONGO_CONNECTION_STRING ||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
`mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
options: {
monitorCommands: true,
},

View File

@ -3,11 +3,11 @@ import request from 'request'
import async from 'async'
import { app } from '../../../app/js/server.js'
const HOST = 'http://localhost:3036'
const HOST = 'http://127.0.0.1:3036'
describe('Getting Contacts', function () {
before(function (done) {
this.server = app.listen(3036, 'localhost', error => {
this.server = app.listen(3036, '127.0.0.1', error => {
if (error != null) {
throw error
}

View File

@ -19,7 +19,7 @@ module.exports = {
check(callback) {
const docId = new ObjectId()
const projectId = new ObjectId(settings.docstore.healthCheck.project_id)
const url = `http://localhost:${port}/project/${projectId}/doc/${docId}`
const url = `http://127.0.0.1:${port}/project/${projectId}/doc/${docId}`
const lines = [
'smoke test - delete me',
`${crypto.randomBytes(32).toString('hex')}`,

View File

@ -5,7 +5,7 @@ const Settings = {
internal: {
docstore: {
port: 3016,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},

View File

@ -14,7 +14,7 @@ module.exports = {
}
this.initing = true
this.callbacks.push(callback)
app.listen(settings.internal.docstore.port, 'localhost', error => {
app.listen(settings.internal.docstore.port, '127.0.0.1', error => {
if (error != null) {
throw error
}

View File

@ -33,7 +33,7 @@ module.exports = DocstoreClient = {
getDoc(projectId, docId, qs, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
json: true,
qs,
},
@ -44,7 +44,7 @@ module.exports = DocstoreClient = {
peekDoc(projectId, docId, qs, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/peek`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/peek`,
json: true,
qs,
},
@ -55,7 +55,7 @@ module.exports = DocstoreClient = {
isDocDeleted(projectId, docId, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/deleted`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/deleted`,
json: true,
},
callback
@ -65,7 +65,7 @@ module.exports = DocstoreClient = {
getAllDocs(projectId, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc`,
json: true,
},
(req, res, body) => {
@ -77,7 +77,7 @@ module.exports = DocstoreClient = {
getAllDeletedDocs(projectId, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc-deleted`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc-deleted`,
json: true,
},
(error, res, body) => {
@ -93,7 +93,7 @@ module.exports = DocstoreClient = {
getAllRanges(projectId, callback) {
request.get(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/ranges`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/ranges`,
json: true,
},
callback
@ -103,7 +103,7 @@ module.exports = DocstoreClient = {
updateDoc(projectId, docId, lines, version, ranges, callback) {
return request.post(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
json: {
lines,
version,
@ -147,7 +147,7 @@ module.exports = DocstoreClient = {
deleteDocWithDateAndName(projectId, docId, deletedAt, name, callback) {
request.patch(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}`,
json: { name, deleted: true, deletedAt },
},
callback
@ -157,7 +157,7 @@ module.exports = DocstoreClient = {
archiveAllDoc(projectId, callback) {
request.post(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/archive`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/archive`,
},
callback
)
@ -166,7 +166,7 @@ module.exports = DocstoreClient = {
archiveDoc(projectId, docId, callback) {
request.post(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/archive`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/doc/${docId}/archive`,
},
callback
)
@ -175,7 +175,7 @@ module.exports = DocstoreClient = {
destroyAllDoc(projectId, callback) {
request.post(
{
url: `http://localhost:${settings.internal.docstore.port}/project/${projectId}/destroy`,
url: `http://127.0.0.1:${settings.internal.docstore.port}/project/${projectId}/destroy`,
},
callback
)

View File

@ -245,7 +245,7 @@ const port =
Settings.api.documentupdater &&
Settings.api.documentupdater.port) ||
3003
const host = Settings.internal.documentupdater.host || 'localhost'
const host = Settings.internal.documentupdater.host || '127.0.0.1'
if (!module.parent) {
// Called directly

View File

@ -1,7 +1,7 @@
module.exports = {
internal: {
documentupdater: {
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
port: 3003,
},
},
@ -9,20 +9,20 @@ module.exports = {
apis: {
web: {
url: `http://${
process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
}:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
user: process.env.WEB_API_USER || 'overleaf',
pass: process.env.WEB_API_PASSWORD || 'password',
},
project_history: {
url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
},
},
redis: {
pubsub: {
host:
process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
password:
process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@ -34,7 +34,7 @@ module.exports = {
history: {
port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
host:
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
password:
process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
maxRetriesPerRequest: parseInt(
@ -45,7 +45,7 @@ module.exports = {
project_history: {
port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || '6379',
host:
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
password:
process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
maxRetriesPerRequest: parseInt(
@ -64,7 +64,7 @@ module.exports = {
lock: {
port: process.env.LOCK_REDIS_PORT || process.env.REDIS_PORT || '6379',
host:
process.env.LOCK_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.LOCK_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
password:
process.env.LOCK_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
maxRetriesPerRequest: parseInt(
@ -83,7 +83,7 @@ module.exports = {
host:
process.env.DOC_UPDATER_REDIS_HOST ||
process.env.REDIS_HOST ||
'localhost',
'127.0.0.1',
password:
process.env.DOC_UPDATER_REDIS_PASSWORD ||
process.env.REDIS_PASSWORD ||

View File

@ -26,7 +26,7 @@ module.exports = {
}
this.initing = true
this.callbacks.push(callback)
app.listen(3003, 'localhost', error => {
app.listen(3003, '127.0.0.1', error => {
if (error != null) {
throw error
}

View File

@ -97,7 +97,7 @@ module.exports = DocUpdaterClient = {
getDoc(projectId, docId, callback) {
request.get(
`http://localhost:3003/project/${projectId}/doc/${docId}`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
(error, res, body) => {
if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
body = JSON.parse(body)
@ -109,7 +109,7 @@ module.exports = DocUpdaterClient = {
getDocAndRecentOps(projectId, docId, fromVersion, callback) {
request.get(
`http://localhost:3003/project/${projectId}/doc/${docId}?fromVersion=${fromVersion}`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}?fromVersion=${fromVersion}`,
(error, res, body) => {
if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
body = JSON.parse(body)
@ -129,7 +129,7 @@ module.exports = DocUpdaterClient = {
peekDoc(projectId, docId, callback) {
request.get(
`http://localhost:3003/project/${projectId}/doc/${docId}/peek`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}/peek`,
(error, res, body) => {
if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
body = JSON.parse(body)
@ -141,7 +141,7 @@ module.exports = DocUpdaterClient = {
flushDoc(projectId, docId, callback) {
request.post(
`http://localhost:3003/project/${projectId}/doc/${docId}/flush`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}/flush`,
(error, res, body) => callback(error, res, body)
)
},
@ -149,7 +149,7 @@ module.exports = DocUpdaterClient = {
setDocLines(projectId, docId, lines, source, userId, undoing, callback) {
request.post(
{
url: `http://localhost:3003/project/${projectId}/doc/${docId}`,
url: `http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
json: {
lines,
source,
@ -163,36 +163,36 @@ module.exports = DocUpdaterClient = {
deleteDoc(projectId, docId, callback) {
request.del(
`http://localhost:3003/project/${projectId}/doc/${docId}`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}`,
(error, res, body) => callback(error, res, body)
)
},
flushProject(projectId, callback) {
request.post(`http://localhost:3003/project/${projectId}/flush`, callback)
request.post(`http://127.0.0.1:3003/project/${projectId}/flush`, callback)
},
deleteProject(projectId, callback) {
request.del(`http://localhost:3003/project/${projectId}`, callback)
request.del(`http://127.0.0.1:3003/project/${projectId}`, callback)
},
deleteProjectOnShutdown(projectId, callback) {
request.del(
`http://localhost:3003/project/${projectId}?background=true&shutdown=true`,
`http://127.0.0.1:3003/project/${projectId}?background=true&shutdown=true`,
callback
)
},
flushOldProjects(callback) {
request.get(
'http://localhost:3003/flush_queued_projects?min_delete_age=1',
'http://127.0.0.1:3003/flush_queued_projects?min_delete_age=1',
callback
)
},
acceptChange(projectId, docId, changeId, callback) {
request.post(
`http://localhost:3003/project/${projectId}/doc/${docId}/change/${changeId}/accept`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}/change/${changeId}/accept`,
callback
)
},
@ -200,7 +200,7 @@ module.exports = DocUpdaterClient = {
acceptChanges(projectId, docId, changeIds, callback) {
request.post(
{
url: `http://localhost:3003/project/${projectId}/doc/${docId}/change/accept`,
url: `http://127.0.0.1:3003/project/${projectId}/doc/${docId}/change/accept`,
json: { change_ids: changeIds },
},
callback
@ -209,14 +209,14 @@ module.exports = DocUpdaterClient = {
removeComment(projectId, docId, comment, callback) {
request.del(
`http://localhost:3003/project/${projectId}/doc/${docId}/comment/${comment}`,
`http://127.0.0.1:3003/project/${projectId}/doc/${docId}/comment/${comment}`,
callback
)
},
getProjectDocs(projectId, projectStateHash, callback) {
request.get(
`http://localhost:3003/project/${projectId}/doc?state=${projectStateHash}`,
`http://127.0.0.1:3003/project/${projectId}/doc?state=${projectStateHash}`,
(error, res, body) => {
if (body != null && res.statusCode >= 200 && res.statusCode < 300) {
body = JSON.parse(body)
@ -229,7 +229,7 @@ module.exports = DocUpdaterClient = {
sendProjectUpdate(projectId, userId, updates, version, callback) {
request.post(
{
url: `http://localhost:3003/project/${projectId}`,
url: `http://127.0.0.1:3003/project/${projectId}`,
json: { userId, updates, version },
},
(error, res, body) => callback(error, res, body)

View File

@ -4,7 +4,7 @@ const rclient1 = redis.createClient({
cluster: [
{
port: '7000',
host: 'localhost',
host: '127.0.0.1',
},
],
})
@ -13,7 +13,7 @@ const rclient2 = redis.createClient({
cluster: [
{
port: '7000',
host: 'localhost',
host: '127.0.0.1',
},
],
})

View File

@ -4,7 +4,7 @@ const rclient1 = redis.createClient({
cluster: [
{
port: '7000',
host: 'localhost',
host: '127.0.0.1',
},
],
})
@ -13,7 +13,7 @@ const rclient2 = redis.createClient({
cluster: [
{
port: '7000',
host: 'localhost',
host: '127.0.0.1',
},
],
})

View File

@ -37,7 +37,7 @@ const settings = {
internal: {
filestore: {
port: 3009,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},

View File

@ -1,5 +1,5 @@
FROM fsouza/fake-gcs-server:1.20
RUN apk add --update --no-cache curl
COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090
HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://127.0.0.1:9090
CMD ["--port=9090", "--scheme=http"]

View File

@ -1,4 +1,4 @@
FROM adobe/s3mock:2.4.14
RUN apk add --update --no-cache curl
COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090
HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://127.0.0.1:9090

View File

@ -32,7 +32,7 @@ class FilestoreApp {
await new Promise((resolve, reject) => {
this.server = this.app.listen(
Settings.internal.filestore.port,
'localhost',
'127.0.0.1',
err => {
if (err) {
return reject(err)

View File

@ -36,7 +36,7 @@ const BackendSettings = require('./TestConfig')
describe('Filestore', function () {
this.timeout(1000 * 10)
const filestoreUrl = `http://localhost:${Settings.internal.filestore.port}`
const filestoreUrl = `http://127.0.0.1:${Settings.internal.filestore.port}`
const seenSockets = []
async function expectNoSockets() {

View File

@ -16,7 +16,7 @@ const Swagger = require('swagger-client')
const app = require('../../../../../app')
function testUrl(pathname, opts = {}) {
const url = new URL('http://localhost')
const url = new URL('http://127.0.0.1')
url.port = exports.server.address().port
url.pathname = pathname
if (opts.qs) {

View File

@ -49,7 +49,7 @@ app.get('/health_check', (req, res) =>
app.get('*', (req, res) => res.sendStatus(404))
const host = Settings.internal?.notifications?.host || 'localhost'
const host = Settings.internal?.notifications?.host || '127.0.0.1'
const port = Settings.internal?.notifications?.port || 3042
mongoClient

View File

@ -24,7 +24,7 @@ module.exports = {
let notificationKey = `smoke-test-notification-${new ObjectId()}`
const getOpts = endPath => ({
url: `http://localhost:${port}/user/${userId}${endPath}`,
url: `http://127.0.0.1:${port}/user/${userId}${endPath}`,
timeout: 5000,
})
logger.debug(

View File

@ -2,14 +2,14 @@ module.exports = {
internal: {
notifications: {
port: 3042,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
mongo: {
url:
process.env.MONGO_CONNECTION_STRING ||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
`mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
options: {
monitorCommands: true,
},

View File

@ -18,12 +18,12 @@ const { port } = settings.internal.history
export function check(callback) {
const projectId = new ObjectId(settings.history.healthCheck.project_id)
const url = `http://localhost:${port}/project/${projectId}`
const url = `http://127.0.0.1:${port}/project/${projectId}`
logger.debug({ projectId }, 'running health check')
const jobs = [
cb =>
request.get(
{ url: `http://localhost:${port}/check_lock`, timeout: 3000 },
{ url: `http://127.0.0.1:${port}/check_lock`, timeout: 3000 },
function (err, res, body) {
if (err != null) {
OError.tag(err, 'error checking lock for health check', {

View File

@ -2,7 +2,7 @@ module.exports = {
mongo: {
url:
process.env.MONGO_CONNECTION_STRING ||
`mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`,
`mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
options: {
monitorCommands: true,
},
@ -10,25 +10,25 @@ module.exports = {
internal: {
history: {
port: 3054,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
apis: {
documentupdater: {
url: `http://${process.env.DOCUPDATER_HOST || 'localhost'}:3003`,
url: `http://${process.env.DOCUPDATER_HOST || '127.0.0.1'}:3003`,
},
docstore: {
url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
},
filestore: {
url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
},
history_v1: {
requestTimeout: parseInt(process.env.V1_REQUEST_TIMEOUT || '300000', 10),
},
web: {
url: `http://${
process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
}:${process.env.WEB_PORT || 3000}`,
user: process.env.WEB_API_USER || 'overleaf',
pass: process.env.WEB_API_PASSWORD || 'password',
@ -40,7 +40,7 @@ module.exports = {
},
redis: {
lock: {
host: process.env.REDIS_HOST || 'localhost',
host: process.env.REDIS_HOST || '127.0.0.1',
password: process.env.REDIS_PASSWORD,
port: process.env.REDIS_PORT || 6379,
key_schema: {
@ -51,7 +51,7 @@ module.exports = {
},
project_history: {
host:
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.HISTORY_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
port: process.env.HISTORY_REDIS_PORT || process.env.REDIS_PORT || 6379,
password:
process.env.HISTORY_REDIS_PASSWORD || process.env.REDIS_PASSWORD,
@ -82,7 +82,7 @@ module.exports = {
`http://${
process.env.V1_HISTORY_HOST ||
process.env.HISTORY_V1_HOST ||
'localhost'
'127.0.0.1'
}:3100/api`,
user: process.env.V1_HISTORY_USER || 'staging',
pass: process.env.V1_HISTORY_PASSWORD || 'password',

View File

@ -5,8 +5,8 @@ import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)
describe('Deleting project', function () {

View File

@ -7,8 +7,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
function createMockBlob(historyId, content) {
const sha = crypto.createHash('sha1').update(content).digest('hex')
@ -316,7 +316,7 @@ describe('Diffs', function () {
request.get(
{
url: `http://localhost:3054/project/${this.projectId}/diff`,
url: `http://127.0.0.1:3054/project/${this.projectId}/diff`,
qs: {
pathname: 'not_here.tex',
from: 3,

View File

@ -21,8 +21,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
describe('DiscardingUpdates', function () {
beforeEach(function (done) {

View File

@ -24,9 +24,9 @@ import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
import * as HistoryId from './helpers/HistoryId.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockFileStore = () => nock('http://localhost:3009')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockFileStore = () => nock('http://127.0.0.1:3009')
const MockWeb = () => nock('http://127.0.0.1:3000')
const sha = data => crypto.createHash('sha1').update(data).digest('hex')

View File

@ -8,8 +8,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
describe('Flushing old queues', function () {
const historyId = new ObjectId().toString()
@ -90,7 +90,7 @@ describe('Flushing old queues', function () {
it('flushes the project history queue', function (done) {
request.post(
{
url: 'http://localhost:3054/flush/old?maxAge=10800',
url: 'http://127.0.0.1:3054/flush/old?maxAge=10800',
},
(error, res, body) => {
if (error) {
@ -109,7 +109,7 @@ describe('Flushing old queues', function () {
it('flushes the project history queue in the background when requested', function (done) {
request.post(
{
url: 'http://localhost:3054/flush/old?maxAge=10800&background=1',
url: 'http://127.0.0.1:3054/flush/old?maxAge=10800&background=1',
},
(error, res, body) => {
if (error) {
@ -166,7 +166,7 @@ describe('Flushing old queues', function () {
it('does not flush the project history queue', function (done) {
request.post(
{
url: `http://localhost:3054/flush/old?maxAge=${3 * 3600}`,
url: `http://127.0.0.1:3054/flush/old?maxAge=${3 * 3600}`,
},
(error, res, body) => {
if (error) {
@ -213,7 +213,7 @@ describe('Flushing old queues', function () {
it('flushes the project history queue anyway', function (done) {
request.post(
{
url: `http://localhost:3054/flush/old?maxAge=${3 * 3600}`,
url: `http://127.0.0.1:3054/flush/old?maxAge=${3 * 3600}`,
},
(error, res, body) => {
if (error) {

View File

@ -18,8 +18,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
describe('Health Check', function () {
beforeEach(function (done) {
@ -62,7 +62,7 @@ describe('Health Check', function () {
return it('should respond to the health check', function (done) {
return request.get(
{
url: 'http://localhost:3054/health_check',
url: 'http://127.0.0.1:3054/health_check',
},
(error, res, body) => {
if (error != null) {

View File

@ -19,9 +19,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockFileStore = () => nock('http://localhost:3009')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockFileStore = () => nock('http://127.0.0.1:3009')
const MockWeb = () => nock('http://127.0.0.1:3000')
const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)

View File

@ -5,8 +5,8 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)

View File

@ -8,10 +8,10 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockWeb = () => nock('http://127.0.0.1:3000')
const MockCallback = () => nock('http://localhost')
const MockCallback = () => nock('http://127.0.0.1')
describe('Retrying failed projects', function () {
const historyId = new ObjectId().toString()
@ -95,7 +95,7 @@ describe('Retrying failed projects', function () {
it('flushes the project history queue', function (done) {
request.post(
{
url: 'http://localhost:3054/retry/failures?failureType=soft&limit=1&timeout=10000',
url: 'http://127.0.0.1:3054/retry/failures?failureType=soft&limit=1&timeout=10000',
},
(error, res, body) => {
if (error) {
@ -118,7 +118,7 @@ describe('Retrying failed projects', function () {
.reply(200)
request.post(
{
url: 'http://localhost:3054/retry/failures?failureType=soft&limit=1&timeout=10000&callbackUrl=http%3A%2F%2Flocalhost%2Fping',
url: 'http://127.0.0.1:3054/retry/failures?failureType=soft&limit=1&timeout=10000&callbackUrl=http%3A%2F%2F127.0.0.1%2Fping',
headers: {
'X-CALLBACK-Authorization': '123',
},
@ -177,7 +177,7 @@ describe('Retrying failed projects', function () {
request.post(
{
url: 'http://localhost:3054/retry/failures?failureType=hard&limit=1&timeout=10000',
url: 'http://127.0.0.1:3054/retry/failures?failureType=hard&limit=1&timeout=10000',
},
(error, res, body) => {
if (error) {

View File

@ -9,9 +9,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockFileStore = () => nock('http://localhost:3009')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockFileStore = () => nock('http://127.0.0.1:3009')
const MockWeb = () => nock('http://127.0.0.1:3000')
// Some helper methods to make the tests more compact
function slTextUpdate(historyId, doc, userId, v, ts, op) {
@ -57,7 +57,7 @@ function slAddFileUpdate(historyId, file, userId, ts, projectId) {
return {
projectHistoryId: historyId,
pathname: file.pathname,
url: `http://localhost:3009/project/${projectId}/file/${file.id}`,
url: `http://127.0.0.1:3009/project/${projectId}/file/${file.id}`,
file: file.id,
meta: { user_id: userId, ts: ts.getTime() },
}

View File

@ -21,9 +21,9 @@ import * as ProjectHistoryClient from './helpers/ProjectHistoryClient.js'
import * as ProjectHistoryApp from './helpers/ProjectHistoryApp.js'
const { ObjectId } = mongodb
const MockHistoryStore = () => nock('http://localhost:3100')
const MockFileStore = () => nock('http://localhost:3009')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockFileStore = () => nock('http://127.0.0.1:3009')
const MockWeb = () => nock('http://127.0.0.1:3000')
const fixture = path => new URL(`../fixtures/${path}`, import.meta.url)

View File

@ -10,9 +10,9 @@ const { ObjectId } = mongodb
const EMPTY_FILE_HASH = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
const MockHistoryStore = () => nock('http://localhost:3100')
const MockFileStore = () => nock('http://localhost:3009')
const MockWeb = () => nock('http://localhost:3000')
const MockHistoryStore = () => nock('http://127.0.0.1:3100')
const MockFileStore = () => nock('http://127.0.0.1:3009')
const MockWeb = () => nock('http://127.0.0.1:3000')
describe('Syncing with web and doc-updater', function () {
const historyId = new ObjectId().toString()
@ -68,7 +68,7 @@ describe('Syncing with web and doc-updater', function () {
it('404s if project-history is not enabled', function (done) {
request.post(
{
url: `http://localhost:3054/project/${this.project_id}/resync`,
url: `http://127.0.0.1:3054/project/${this.project_id}/resync`,
},
(error, res, body) => {
if (error) {
@ -244,7 +244,7 @@ describe('Syncing with web and doc-updater', function () {
{
file: this.file_id,
path: '/test.png',
url: `http://localhost:3009/project/${this.project_id}/file/${this.file_id}`,
url: `http://127.0.0.1:3009/project/${this.project_id}/file/${this.file_id}`,
},
{ path: '/persistedFile' },
],

View File

@ -27,7 +27,7 @@ export function ensureRunning(callback) {
}
initing = true
callbacks.push(callback)
app.listen(3054, 'localhost', error => {
app.listen(3054, '127.0.0.1', error => {
if (error != null) {
throw error
}

View File

@ -14,7 +14,7 @@ export function resetDatabase(callback) {
export function initializeProject(historyId, callback) {
request.post(
{
url: 'http://localhost:3054/project',
url: 'http://127.0.0.1:3054/project',
json: { historyId },
},
(error, res, body) => {
@ -37,7 +37,7 @@ export function flushProject(projectId, options, callback) {
}
request.post(
{
url: `http://localhost:3054/project/${projectId}/flush`,
url: `http://127.0.0.1:3054/project/${projectId}/flush`,
},
(error, res, body) => {
if (error) {
@ -54,7 +54,7 @@ export function flushProject(projectId, options, callback) {
export function getSummarizedUpdates(projectId, query, callback) {
request.get(
{
url: `http://localhost:3054/project/${projectId}/updates`,
url: `http://127.0.0.1:3054/project/${projectId}/updates`,
qs: query,
json: true,
},
@ -71,7 +71,7 @@ export function getSummarizedUpdates(projectId, query, callback) {
export function getDiff(projectId, pathname, from, to, callback) {
request.get(
{
url: `http://localhost:3054/project/${projectId}/diff`,
url: `http://127.0.0.1:3054/project/${projectId}/diff`,
qs: {
pathname,
from,
@ -92,7 +92,7 @@ export function getDiff(projectId, pathname, from, to, callback) {
export function getFileTreeDiff(projectId, from, to, callback) {
request.get(
{
url: `http://localhost:3054/project/${projectId}/filetree/diff`,
url: `http://127.0.0.1:3054/project/${projectId}/filetree/diff`,
qs: {
from,
to,
@ -118,7 +118,7 @@ export function getSnapshot(projectId, pathname, version, options, callback) {
}
request.get(
{
url: `http://localhost:3054/project/${projectId}/version/${version}/${encodeURIComponent(
url: `http://127.0.0.1:3054/project/${projectId}/version/${version}/${encodeURIComponent(
pathname
)}`,
},
@ -171,7 +171,7 @@ export function getQueueLength(projectId, callback) {
export function getQueueCounts(callback) {
return request.get(
{
url: 'http://localhost:3054/status/queue',
url: 'http://127.0.0.1:3054/status/queue',
json: true,
},
callback
@ -181,7 +181,7 @@ export function getQueueCounts(callback) {
export function resyncHistory(projectId, callback) {
request.post(
{
url: `http://localhost:3054/project/${projectId}/resync`,
url: `http://127.0.0.1:3054/project/${projectId}/resync`,
json: true,
body: { origin: { kind: 'test-origin' } },
},
@ -205,7 +205,7 @@ export function createLabel(
) {
request.post(
{
url: `http://localhost:3054/project/${projectId}/user/${userId}/labels`,
url: `http://127.0.0.1:3054/project/${projectId}/user/${userId}/labels`,
json: { comment, version, created_at: createdAt },
},
(error, res, body) => {
@ -221,7 +221,7 @@ export function createLabel(
export function getLabels(projectId, callback) {
request.get(
{
url: `http://localhost:3054/project/${projectId}/labels`,
url: `http://127.0.0.1:3054/project/${projectId}/labels`,
json: true,
},
(error, res, body) => {
@ -237,7 +237,7 @@ export function getLabels(projectId, callback) {
export function deleteLabelForUser(projectId, userId, labelId, callback) {
request.delete(
{
url: `http://localhost:3054/project/${projectId}/user/${userId}/labels/${labelId}`,
url: `http://127.0.0.1:3054/project/${projectId}/user/${userId}/labels/${labelId}`,
},
(error, res, body) => {
if (error) {
@ -252,7 +252,7 @@ export function deleteLabelForUser(projectId, userId, labelId, callback) {
export function deleteLabel(projectId, labelId, callback) {
request.delete(
{
url: `http://localhost:3054/project/${projectId}/labels/${labelId}`,
url: `http://127.0.0.1:3054/project/${projectId}/labels/${labelId}`,
},
(error, res, body) => {
if (error) {
@ -279,7 +279,7 @@ export function setFailure(failureEntry, callback) {
export function transferLabelOwnership(fromUser, toUser, callback) {
request.post(
{
url: `http://localhost:3054/user/${fromUser}/labels/transfer/${toUser}`,
url: `http://127.0.0.1:3054/user/${fromUser}/labels/transfer/${toUser}`,
},
(error, res, body) => {
if (error) {
@ -293,7 +293,7 @@ export function transferLabelOwnership(fromUser, toUser, callback) {
export function getDump(projectId, callback) {
request.get(
`http://localhost:3054/project/${projectId}/dump`,
`http://127.0.0.1:3054/project/${projectId}/dump`,
(err, res, body) => {
if (err) {
return callback(err)
@ -305,7 +305,7 @@ export function getDump(projectId, callback) {
}
export function deleteProject(projectId, callback) {
request.delete(`http://localhost:3054/project/${projectId}`, (err, res) => {
request.delete(`http://127.0.0.1:3054/project/${projectId}`, (err, res) => {
if (err) {
return callback(err)
}

View File

@ -4,7 +4,7 @@ const settings = {
redis: {
pubsub: {
host:
process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
password:
process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@ -19,7 +19,7 @@ const settings = {
host:
process.env.REAL_TIME_REDIS_HOST ||
process.env.REDIS_HOST ||
'localhost',
'127.0.0.1',
port:
process.env.REAL_TIME_REDIS_PORT || process.env.REDIS_PORT || '6379',
password:
@ -45,7 +45,7 @@ const settings = {
host:
process.env.DOC_UPDATER_REDIS_HOST ||
process.env.REDIS_HOST ||
'localhost',
'127.0.0.1',
port:
process.env.DOC_UPDATER_REDIS_PORT || process.env.REDIS_PORT || '6379',
password:
@ -68,7 +68,7 @@ const settings = {
host:
process.env.SESSIONS_REDIS_HOST ||
process.env.REDIS_HOST ||
'localhost',
'127.0.0.1',
port: process.env.SESSIONS_REDIS_PORT || process.env.REDIS_PORT || '6379',
password:
process.env.SESSIONS_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
@ -83,14 +83,14 @@ const settings = {
internal: {
realTime: {
port: 3026,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
apis: {
web: {
url: `http://${
process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
}:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
user: process.env.WEB_API_USER || 'overleaf',
pass: process.env.WEB_API_PASSWORD || 'password',
@ -99,7 +99,7 @@ const settings = {
url: `http://${
process.env.DOCUMENT_UPDATER_HOST ||
process.env.DOCUPDATER_HOST ||
'localhost'
'127.0.0.1'
}:3003`,
},
},

View File

@ -16,7 +16,7 @@ const request = require('request')
const drain = function (rate, callback) {
request.post(
{
url: `http://localhost:3026/drain?rate=${rate}`,
url: `http://127.0.0.1:3026/drain?rate=${rate}`,
},
(error, response, data) => callback(error, data)
)

View File

@ -8,7 +8,7 @@
const async = require('async')
const { expect } = require('chai')
const request = require('request').defaults({
baseUrl: 'http://localhost:3026',
baseUrl: 'http://127.0.0.1:3026',
})
const RealTimeClient = require('./helpers/RealTimeClient')

View File

@ -74,7 +74,7 @@ module.exports = Client = {
},
connect(projectId, callback) {
const client = io.connect('http://localhost:3026', {
const client = io.connect('http://127.0.0.1:3026', {
'force new connection': true,
query: new URLSearchParams({ projectId }).toString(),
})
@ -105,7 +105,7 @@ module.exports = Client = {
}
return request.get(
{
url: 'http://localhost:3026/clients',
url: 'http://127.0.0.1:3026/clients',
json: true,
},
(error, response, data) => callback(error, data)
@ -118,7 +118,7 @@ module.exports = Client = {
}
return request.get(
{
url: `http://localhost:3026/clients/${clientId}`,
url: `http://127.0.0.1:3026/clients/${clientId}`,
json: true,
},
(error, response, data) => {
@ -134,7 +134,7 @@ module.exports = Client = {
disconnectClient(clientId, callback) {
request.post(
{
url: `http://localhost:3026/client/${clientId}/disconnect`,
url: `http://127.0.0.1:3026/client/${clientId}/disconnect`,
},
(error, response, data) => callback(error, data)
)

View File

@ -33,7 +33,7 @@ module.exports = {
Settings.internal != null ? Settings.internal.realtime : undefined,
x => x.port
),
'localhost',
'127.0.0.1',
error => {
if (error != null) {
throw error

View File

@ -273,7 +273,7 @@ exports.XMLHttpRequest = function () {
case undefined:
case '':
host = 'localhost'
host = '127.0.0.1'
break
default:
@ -309,8 +309,8 @@ exports.XMLHttpRequest = function () {
return
}
// Default to port 80. If accessing localhost on another port be sure
// to use http://localhost:port/path
// Default to port 80. If accessing 127.0.0.1 on another port be sure
// to use http://127.0.0.1:port/path
const port = url.port || (ssl ? 443 : 80)
// Add query string if one is used
const uri = url.pathname + (url.search ? url.search : '')

View File

@ -7,7 +7,7 @@ import { app } from './app/js/server.js'
import * as ASpell from './app/js/ASpell.js'
import Metrics from '@overleaf/metrics'
const { host = 'localhost', port = 3005 } = Settings.internal?.spelling ?? {}
const { host = '127.0.0.1', port = 3005 } = Settings.internal?.spelling ?? {}
ASpell.startCacheDump()

View File

@ -5,7 +5,7 @@ import OError from '@overleaf/o-error'
export function healthCheck(req, res) {
const opts = {
url: `http://localhost:3005/user/${settings.healthCheckUserId}/check`,
url: `http://127.0.0.1:3005/user/${settings.healthCheckUserId}/check`,
json: {
words: ['helllo'],
language: 'en',

View File

@ -4,7 +4,7 @@ module.exports = {
internal: {
spelling: {
port: 3005,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},

View File

@ -2,5 +2,5 @@ import { app } from '../../../app/js/server.js'
import { PORT } from './helpers/request.js'
before(function (done) {
return app.listen(PORT, 'localhost', done)
return app.listen(PORT, '127.0.0.1', done)
})

View File

@ -3,7 +3,7 @@ import Request from 'request'
export const PORT = 3005
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:${PORT}`
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:${PORT}`
const request = Request.defaults({
baseUrl: BASE_URL,

View File

@ -87,7 +87,7 @@ const makeRequest = function (correctWords, incorrectWords, callback) {
}
}
return request.post(
'http://localhost:3005/user/1/check',
'http://127.0.0.1:3005/user/1/check',
{ json: true, body: { words: full } },
function (err, req, body) {
let m

View File

@ -48,7 +48,7 @@ if (Settings.catchErrors) {
FileWriter.ensureDumpFolderExists()
const port = Settings.port || Settings.internal.web.port || 3000
const host = Settings.internal.web.host || 'localhost'
const host = Settings.internal.web.host || '127.0.0.1'
if (!module.parent) {
// Called directly

View File

@ -174,7 +174,7 @@ module.exports = {
redis: {
web: {
host: process.env.REDIS_HOST || 'localhost',
host: process.env.REDIS_HOST || '127.0.0.1',
port: process.env.REDIS_PORT || '6379',
password: process.env.REDIS_PASSWORD || '',
db: process.env.REDIS_DB,
@ -185,36 +185,36 @@ module.exports = {
// websessions:
// cluster: [
// {host: 'localhost', port: 7000}
// {host: 'localhost', port: 7001}
// {host: 'localhost', port: 7002}
// {host: 'localhost', port: 7003}
// {host: 'localhost', port: 7004}
// {host: 'localhost', port: 7005}
// {host: '127.0.0.1', port: 7000}
// {host: '127.0.0.1', port: 7001}
// {host: '127.0.0.1', port: 7002}
// {host: '127.0.0.1', port: 7003}
// {host: '127.0.0.1', port: 7004}
// {host: '127.0.0.1', port: 7005}
// ]
// ratelimiter:
// cluster: [
// {host: 'localhost', port: 7000}
// {host: 'localhost', port: 7001}
// {host: 'localhost', port: 7002}
// {host: 'localhost', port: 7003}
// {host: 'localhost', port: 7004}
// {host: 'localhost', port: 7005}
// {host: '127.0.0.1', port: 7000}
// {host: '127.0.0.1', port: 7001}
// {host: '127.0.0.1', port: 7002}
// {host: '127.0.0.1', port: 7003}
// {host: '127.0.0.1', port: 7004}
// {host: '127.0.0.1', port: 7005}
// ]
// cooldown:
// cluster: [
// {host: 'localhost', port: 7000}
// {host: 'localhost', port: 7001}
// {host: 'localhost', port: 7002}
// {host: 'localhost', port: 7003}
// {host: 'localhost', port: 7004}
// {host: 'localhost', port: 7005}
// {host: '127.0.0.1', port: 7000}
// {host: '127.0.0.1', port: 7001}
// {host: '127.0.0.1', port: 7002}
// {host: '127.0.0.1', port: 7003}
// {host: '127.0.0.1', port: 7004}
// {host: '127.0.0.1', port: 7005}
// ]
api: {
host: process.env.REDIS_HOST || 'localhost',
host: process.env.REDIS_HOST || '127.0.0.1',
port: process.env.REDIS_PORT || '6379',
password: process.env.REDIS_PASSWORD || '',
maxRetriesPerRequest: parseInt(
@ -232,7 +232,7 @@ module.exports = {
internal: {
web: {
port: process.env.WEB_PORT || 3000,
host: process.env.LISTEN_ADDRESS || 'localhost',
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
@ -242,7 +242,7 @@ module.exports = {
apis: {
web: {
url: `http://${
process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
}:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
user: httpAuthUser,
pass: httpAuthPass,
@ -251,25 +251,25 @@ module.exports = {
url: `http://${
process.env.DOCUPDATER_HOST ||
process.env.DOCUMENT_UPDATER_HOST ||
'localhost'
'127.0.0.1'
}:3003`,
},
spelling: {
url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
url: `http://${process.env.SPELLING_HOST || '127.0.0.1'}:3005`,
host: process.env.SPELLING_HOST,
},
docstore: {
url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
pubUrl: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
pubUrl: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
},
chat: {
internal_url: `http://${process.env.CHAT_HOST || 'localhost'}:3010`,
internal_url: `http://${process.env.CHAT_HOST || '127.0.0.1'}:3010`,
},
filestore: {
url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
},
clsi: {
url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
// url: "http://#{process.env['CLSI_LB_HOST']}:3014"
backendGroupName: undefined,
submissionBackendClass:
@ -277,19 +277,19 @@ module.exports = {
},
project_history: {
sendProjectStructureOps: true,
url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
},
realTime: {
url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
url: `http://${process.env.REALTIME_HOST || '127.0.0.1'}:3026`,
},
contacts: {
url: `http://${process.env.CONTACTS_HOST || 'localhost'}:3036`,
url: `http://${process.env.CONTACTS_HOST || '127.0.0.1'}:3036`,
},
notifications: {
url: `http://${process.env.NOTIFICATIONS_HOST || 'localhost'}:3042`,
url: `http://${process.env.NOTIFICATIONS_HOST || '127.0.0.1'}:3042`,
},
webpack: {
url: `http://${process.env.WEBPACK_HOST || 'localhost'}:3808`,
url: `http://${process.env.WEBPACK_HOST || '127.0.0.1'}:3808`,
},
wiki: {
url: process.env.WIKI_URL || 'https://learn.sharelatex.com',
@ -328,7 +328,7 @@ module.exports = {
// Where your instance of Overleaf Community Edition/Server Pro can be found publicly. Used in emails
// that are sent out, generated links, etc.
siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://localhost:3000'),
siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://127.0.0.1:3000'),
lockManager: {
lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),

View File

@ -6,7 +6,7 @@ QUEUES_REDIS_HOST=redis
ANALYTICS_QUEUES_REDIS_HOST=redis
MONGO_URL=mongodb://mongo/test-overleaf
OVERLEAF_ALLOW_PUBLIC_ACCESS=true
LINKED_URL_PROXY=http://localhost:6543
LINKED_URL_PROXY=http://127.0.0.1:6543
ENABLED_LINKED_FILE_TYPES=url,project_file,project_output_file,mendeley,zotero
NODE_ENV=test
NODE_OPTIONS=--unhandled-rejections=strict
@ -17,7 +17,7 @@ PUBLIC_URL=http://www.overleaf.test:23000
HTTP_TEST_HOST=www.overleaf.test
OT_JWT_AUTH_KEY="very secret key"
EXTERNAL_AUTH=none
RECAPTCHA_ENDPOINT=http://localhost:2222/recaptcha/api/siteverify
RECAPTCHA_ENDPOINT=http://127.0.0.1:2222/recaptcha/api/siteverify
# Server-Pro LDAP
OVERLEAF_LDAP_URL=ldap://ldap:389
OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com

View File

@ -14,5 +14,5 @@ OVERLEAF_SAML_ENTRYPOINT=http://127.0.0.1:22280/simplesaml/saml2/idp/SSOService.
OVERLEAF_SAML_CALLBACK_URL=http://127.0.0.1:22280/saml/callback
COOKIE_DOMAIN=
PUBLIC_URL=http://localhost:23000
HTTP_TEST_HOST=localhost
PUBLIC_URL=http://127.0.0.1:23000
HTTP_TEST_HOST=127.0.0.1

View File

@ -34,7 +34,7 @@ describe('ServerCEScripts', function () {
try {
run(
'MONGO_SERVER_SELECTION_TIMEOUT=1' +
'MONGO_CONNECTION_STRING=mongodb://localhost:4242 ' +
'MONGO_CONNECTION_STRING=mongodb://127.0.0.1:4242 ' +
'node modules/server-ce-scripts/scripts/check-mongodb'
)
} catch (e) {

View File

@ -41,58 +41,58 @@ module.exports = {
},
web: {
url: 'http://localhost:23000',
url: 'http://127.0.0.1:23000',
user: httpAuthUser,
pass: httpAuthPass,
},
haveIBeenPwned: {
enabled: false,
url: 'http://localhost:1337',
url: 'http://127.0.0.1:1337',
},
documentupdater: {
url: 'http://localhost:23003',
url: 'http://127.0.0.1:23003',
},
spelling: {
url: 'http://localhost:23005',
host: 'localhost',
url: 'http://127.0.0.1:23005',
host: '127.0.0.1',
},
docstore: {
url: 'http://localhost:23016',
pubUrl: 'http://localhost:23016',
url: 'http://127.0.0.1:23016',
pubUrl: 'http://127.0.0.1:23016',
},
chat: {
internal_url: 'http://localhost:23010',
internal_url: 'http://127.0.0.1:23010',
},
filestore: {
url: 'http://localhost:23009',
url: 'http://127.0.0.1:23009',
},
clsi: {
url: 'http://localhost:23013',
url: 'http://127.0.0.1:23013',
},
realTime: {
url: 'http://localhost:23026',
url: 'http://127.0.0.1:23026',
},
contacts: {
url: 'http://localhost:23036',
url: 'http://127.0.0.1:23036',
},
notifications: {
url: 'http://localhost:23042',
url: 'http://127.0.0.1:23042',
},
project_history: {
sendProjectStructureOps: true,
url: `http://localhost:23054`,
url: `http://127.0.0.1:23054`,
},
v1_history: {
url: `http://localhost:23100/api`,
url: `http://127.0.0.1:23100/api`,
user: 'overleaf',
pass: 'password',
},
webpack: {
url: 'http://localhost:23808',
url: 'http://127.0.0.1:23808',
},
gitBridge: {
url: 'http://localhost:28000',
url: 'http://127.0.0.1:28000',
},
},

View File

@ -12,13 +12,13 @@ const overrides = {
apis: {
thirdPartyDataStore: {
url: `http://localhost:23002`,
url: `http://127.0.0.1:23002`,
},
analytics: {
url: `http://localhost:23050`,
url: `http://127.0.0.1:23050`,
},
recurly: {
url: 'http://localhost:26034',
url: 'http://127.0.0.1:26034',
subdomain: 'test',
apiKey: 'private-nonsense',
webhookUser: 'recurly',
@ -31,7 +31,7 @@ const overrides = {
},
v1: {
url: `http://localhost:25000`,
url: `http://127.0.0.1:25000`,
user: 'overleaf',
pass: 'password',
},
@ -66,7 +66,7 @@ const overrides = {
module.exports = baseApp.mergeWith(baseTest.mergeWith(overrides))
for (const redisKey of Object.keys(module.exports.redis)) {
module.exports.redis[redisKey].host = process.env.REDIS_HOST || 'localhost'
module.exports.redis[redisKey].host = process.env.REDIS_HOST || '127.0.0.1'
}
module.exports.mergeWith = function (overrides) {

View File

@ -2,7 +2,7 @@ const { expect } = require('chai')
const fetch = require('node-fetch')
const Settings = require('@overleaf/settings')
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
describe('HttpPermissionsPolicy', function () {
it('should have permissions-policy header on user-facing pages', async function () {

View File

@ -370,7 +370,7 @@ describe('LinkedFiles', function () {
json: {
provider: 'url',
data: {
url: 'ftp://localhost',
url: 'ftp://127.0.0.1',
},
parent_folder_id: projectOneRootFolderId,
name: 'url-test-file-5',

View File

@ -217,7 +217,7 @@ class UserHelper {
* @returns {string} baseUrl
*/
static baseUrl() {
return `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
return `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
}
/**

View File

@ -1,6 +1,6 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || 'localhost'}:23000`
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
const request = require('request').defaults({
baseUrl: BASE_URL,
followRedirect: false,

View File

@ -70,7 +70,7 @@ class MockV1HistoryApi extends AbstractMockApi {
this.requestedZipPacks++
this.events.emit('v1-history-pack-zip')
res.json({
zipUrl: `http://localhost:23100/fake-zip-download/${req.params.project_id}/version/${req.params.version}`,
zipUrl: `http://127.0.0.1:23100/fake-zip-download/${req.params.project_id}/version/${req.params.version}`,
})
}
)

View File

@ -129,7 +129,7 @@ const fetch = require('node-fetch')
globalThis.fetch =
global.fetch =
window.fetch =
(url, ...options) => fetch(new URL(url, 'http://localhost'), ...options)
(url, ...options) => fetch(new URL(url, 'http://127.0.0.1'), ...options)
// ignore CSS files
const { addHook } = require('pirates')

View File

@ -25,7 +25,7 @@ describe('CompileManager', function () {
apis: {
clsi: { submissionBackendClass: 'n2d' },
},
redis: { web: { host: 'localhost', port: 42 } },
redis: { web: { host: '127.0.0.1', port: 42 } },
rateLimit: { autoCompile: {} },
}),
'../../infrastructure/RedisWrapper': {

View File

@ -503,7 +503,7 @@ describe('ExportsHandler', function () {
beforeEach(function (done) {
this.settings.apis = {
v1: {
url: 'http://localhost:5000',
url: 'http://127.0.0.1:5000',
user: 'overleaf',
pass: 'pass',
timeout: 15000,
@ -596,7 +596,7 @@ describe('ExportsHandler', function () {
beforeEach(function (done) {
this.settings.apis = {
v1: {
url: 'http://localhost:5000',
url: 'http://127.0.0.1:5000',
user: 'overleaf',
pass: 'pass',
timeout: 15000,
@ -648,7 +648,7 @@ describe('ExportsHandler', function () {
beforeEach(function (done) {
this.settings.apis = {
v1: {
url: 'http://localhost:5000',
url: 'http://127.0.0.1:5000',
user: 'overleaf',
pass: 'pass',
timeout: 15000,

View File

@ -9,7 +9,7 @@ describe('UrlHelper', function () {
beforeEach(function () {
this.settings = {
apis: { linkedUrlProxy: { url: undefined } },
siteUrl: 'http://localhost:3000',
siteUrl: 'http://127.0.0.1:3000',
}
this.UrlHelper = SandboxedModule.require(modulePath, {
requires: { '@overleaf/settings': this.settings },

View File

@ -101,7 +101,7 @@ describe('TemplatesManager', function () {
path: {
dumpFolder: this.dumpFolder,
},
siteUrl: (this.siteUrl = 'http://localhost:3000'),
siteUrl: (this.siteUrl = 'http://127.0.0.1:3000'),
apis: {
v1: {
url: (this.v1Url = 'http://overleaf.com'),

View File

@ -16,7 +16,7 @@ const collaberatorRef = new ObjectId()
const projectName = 'project_name_here'
const thirdPartyDataStoreApiUrl = 'http://third-party-json-store.herokuapp.com'
const siteUrl = 'http://www.localhost:3000'
const siteUrl = 'http://127.0.0.1:3000'
const filestoreUrl = 'filestore.overleaf.com'
describe('TpdsUpdateSender', function () {