added texliveImageNameOveride
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
settings = require("settings-sharelatex")
|
||||||
|
|
||||||
module.exports = RequestParser =
|
module.exports = RequestParser =
|
||||||
VALID_COMPILERS: ["pdflatex", "latex", "xelatex", "lualatex"]
|
VALID_COMPILERS: ["pdflatex", "latex", "xelatex", "lualatex"]
|
||||||
MAX_TIMEOUT: 300
|
MAX_TIMEOUT: 300
|
||||||
@@ -67,6 +69,10 @@ module.exports = RequestParser =
|
|||||||
sanitizedRootResourcePath = RequestParser._sanitizePath(rootResourcePath)
|
sanitizedRootResourcePath = RequestParser._sanitizePath(rootResourcePath)
|
||||||
response.rootResourcePath = RequestParser._checkPath(sanitizedRootResourcePath)
|
response.rootResourcePath = RequestParser._checkPath(sanitizedRootResourcePath)
|
||||||
|
|
||||||
|
if settings.texliveImageNameOveride?
|
||||||
|
tag = compile.options.imageName.split(":")[1]
|
||||||
|
response.imageName = "#{settings.texliveImageNameOveride}:#{tag}"
|
||||||
|
|
||||||
for resource in response.resources
|
for resource in response.resources
|
||||||
if resource.path == originalRootResourcePath
|
if resource.path == originalRootResourcePath
|
||||||
resource.path = sanitizedRootResourcePath
|
resource.path = sanitizedRootResourcePath
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ module.exports =
|
|||||||
project_cache_length_ms: 1000 * 60 * 60 * 24
|
project_cache_length_ms: 1000 * 60 * 60 * 24
|
||||||
parallelFileDownloads:1
|
parallelFileDownloads:1
|
||||||
filestoreDomainOveride: process.env["FILESTORE_DOMAIN_OVERRIDE"]
|
filestoreDomainOveride: process.env["FILESTORE_DOMAIN_OVERRIDE"]
|
||||||
|
texliveImageNameOveride: process.env["TEX_LIVE_IMAGE_NAME_OVERRIDE"]
|
||||||
|
|
||||||
|
|
||||||
if process.env["DOCKER_RUNNER"]
|
if process.env["DOCKER_RUNNER"]
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ describe "RequestParser", ->
|
|||||||
compile:
|
compile:
|
||||||
token: "token-123"
|
token: "token-123"
|
||||||
options:
|
options:
|
||||||
|
imageName: "basicImageName/here:2017-1"
|
||||||
compiler: "pdflatex"
|
compiler: "pdflatex"
|
||||||
timeout: 42
|
timeout: 42
|
||||||
resources: []
|
resources: []
|
||||||
@RequestParser = SandboxedModule.require modulePath
|
@RequestParser = SandboxedModule.require modulePath, requires:
|
||||||
|
"settings-sharelatex": @settings = {}
|
||||||
|
|
||||||
afterEach ->
|
afterEach ->
|
||||||
tk.reset()
|
tk.reset()
|
||||||
@@ -57,6 +59,21 @@ describe "RequestParser", ->
|
|||||||
it "should set the compiler to pdflatex by default", ->
|
it "should set the compiler to pdflatex by default", ->
|
||||||
@data.compiler.should.equal "pdflatex"
|
@data.compiler.should.equal "pdflatex"
|
||||||
|
|
||||||
|
describe "with imageName set", ->
|
||||||
|
beforeEach ->
|
||||||
|
@RequestParser.parse @validRequest, (error, @data) =>
|
||||||
|
|
||||||
|
it "should set the imageName", ->
|
||||||
|
@data.imageName.should.equal "basicImageName/here:2017-1"
|
||||||
|
|
||||||
|
describe "with texliveImageNameOveride set", ->
|
||||||
|
beforeEach ->
|
||||||
|
@settings.texliveImageNameOveride = "usethisoveride/overhere"
|
||||||
|
@RequestParser.parse @validRequest, (error, @data) =>
|
||||||
|
|
||||||
|
it "should override the image path", ->
|
||||||
|
@data.imageName.should.equal "usethisoveride/overhere:2017-1"
|
||||||
|
|
||||||
describe "without a timeout specified", ->
|
describe "without a timeout specified", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
delete @validRequest.compile.options.timeout
|
delete @validRequest.compile.options.timeout
|
||||||
|
|||||||
Reference in New Issue
Block a user