Merge pull request #8071 from overleaf/jpa-clsi-zonal

[misc] prefix output file downloads with /zone/X

GitOrigin-RevId: ba59e97ae0284c68ba551dd49dc5d3daa4d61aa9
This commit is contained in:
Jakob Ackermann 2022-05-24 09:28:11 +01:00 committed by Copybot
parent d4ed26e3ad
commit 9a71372c36
3 changed files with 10 additions and 5 deletions

View file

@ -125,7 +125,7 @@ module.exports = CompileController = {
outputFiles: outputFiles.map(file => { outputFiles: outputFiles.map(file => {
return { return {
url: url:
`${Settings.apis.clsi.url}/project/${request.project_id}` + `${Settings.apis.clsi.outputUrl}/project/${request.project_id}` +
(request.user_id != null (request.user_id != null
? `/user/${request.user_id}` ? `/user/${request.user_id}`
: '') + : '') +

View file

@ -34,7 +34,12 @@ module.exports = {
}, },
apis: { apis: {
clsi: { 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 || 'localhost'}:3013`,
// External url prefix for output files, e.g. for requests via load-balancers.
outputUrl: `http://${process.env.CLSI_HOST || 'localhost'}:3013${
process.env.ZONE ? `/zone/${process.env.ZONE}` : ''
}`,
}, },
clsiPerf: { clsiPerf: {
host: `${process.env.CLSI_PERF_HOST || 'localhost'}:${ host: `${process.env.CLSI_PERF_HOST || 'localhost'}:${

View file

@ -69,7 +69,7 @@ describe('CompileController', function () {
'@overleaf/settings': (this.Settings = { '@overleaf/settings': (this.Settings = {
apis: { apis: {
clsi: { clsi: {
url: 'http://clsi.example.com', outputUrl: 'http://clsi.example.com',
}, },
}, },
}), }),
@ -157,7 +157,7 @@ describe('CompileController', function () {
timings: this.timings, timings: this.timings,
outputFiles: this.output_files.map(file => { outputFiles: this.output_files.map(file => {
return { return {
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`, url: `${this.Settings.apis.clsi.outputUrl}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
...file, ...file,
} }
}), }),
@ -198,7 +198,7 @@ describe('CompileController', function () {
timings: this.timings, timings: this.timings,
outputFiles: this.output_files.map(file => { outputFiles: this.output_files.map(file => {
return { return {
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`, url: `${this.Settings.apis.clsi.outputUrl}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
...file, ...file,
} }
}), }),
@ -240,7 +240,7 @@ describe('CompileController', function () {
timings: this.timings, timings: this.timings,
outputFiles: this.output_files.map(file => { outputFiles: this.output_files.map(file => {
return { return {
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`, url: `${this.Settings.apis.clsi.outputUrl}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
...file, ...file,
} }
}), }),