mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
added radix to parseInt() calls and make them fail fast (#806)
This commit is contained in:
parent
557a662e8f
commit
a9c02c6bf6
1 changed files with 11 additions and 7 deletions
|
@ -13,9 +13,13 @@ parse = (option)->
|
||||||
opt = JSON.parse(option)
|
opt = JSON.parse(option)
|
||||||
return opt
|
return opt
|
||||||
catch err
|
catch err
|
||||||
console.error "problem parsing #{option}, invalid JSON"
|
throw new Error("problem parsing #{option}, invalid JSON")
|
||||||
return undefined
|
|
||||||
|
|
||||||
|
parseIntOrFail = (value)->
|
||||||
|
parsedValue = parseInt(value, 10)
|
||||||
|
if isNaN(parsedValue)
|
||||||
|
throw new Error("'#{value}' is an invalid integer")
|
||||||
|
return parsedValue
|
||||||
|
|
||||||
DATA_DIR = '/var/lib/sharelatex/data'
|
DATA_DIR = '/var/lib/sharelatex/data'
|
||||||
TMP_DIR = '/var/lib/sharelatex/tmp'
|
TMP_DIR = '/var/lib/sharelatex/tmp'
|
||||||
|
@ -213,7 +217,7 @@ settings =
|
||||||
collaborators: -1
|
collaborators: -1
|
||||||
dropbox: true
|
dropbox: true
|
||||||
versioning: true
|
versioning: true
|
||||||
compileTimeout: parseInt(process.env["COMPILE_TIMEOUT"] or 180, 10)
|
compileTimeout: parseIntOrFail(process.env["COMPILE_TIMEOUT"] or 180)
|
||||||
compileGroup: "standard"
|
compileGroup: "standard"
|
||||||
trackChanges: true
|
trackChanges: true
|
||||||
templates: true
|
templates: true
|
||||||
|
@ -379,7 +383,7 @@ if process.env["SHARELATEX_LDAP_URL"]
|
||||||
timeout: (
|
timeout: (
|
||||||
if _ldap_timeout = process.env["SHARELATEX_LDAP_TIMEOUT"]
|
if _ldap_timeout = process.env["SHARELATEX_LDAP_TIMEOUT"]
|
||||||
try
|
try
|
||||||
parseInt(_ldap_timeout)
|
parseIntOrFail(_ldap_timeout)
|
||||||
catch e
|
catch e
|
||||||
console.error "Cannot parse SHARELATEX_LDAP_TIMEOUT"
|
console.error "Cannot parse SHARELATEX_LDAP_TIMEOUT"
|
||||||
else
|
else
|
||||||
|
@ -388,7 +392,7 @@ if process.env["SHARELATEX_LDAP_URL"]
|
||||||
connectTimeout: (
|
connectTimeout: (
|
||||||
if _ldap_connect_timeout = process.env["SHARELATEX_LDAP_CONNECT_TIMEOUT"]
|
if _ldap_connect_timeout = process.env["SHARELATEX_LDAP_CONNECT_TIMEOUT"]
|
||||||
try
|
try
|
||||||
parseInt(_ldap_connect_timeout)
|
parseIntOrFail(_ldap_connect_timeout)
|
||||||
catch e
|
catch e
|
||||||
console.error "Cannot parse SHARELATEX_LDAP_CONNECT_TIMEOUT"
|
console.error "Cannot parse SHARELATEX_LDAP_CONNECT_TIMEOUT"
|
||||||
else
|
else
|
||||||
|
@ -446,7 +450,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"]
|
||||||
acceptedClockSkewMs: (
|
acceptedClockSkewMs: (
|
||||||
if _saml_skew = process.env["SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"]
|
if _saml_skew = process.env["SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"]
|
||||||
try
|
try
|
||||||
parseInt(_saml_skew)
|
parseIntOrFail(_saml_skew)
|
||||||
catch e
|
catch e
|
||||||
console.error "Cannot parse SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"
|
console.error "Cannot parse SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"
|
||||||
else
|
else
|
||||||
|
@ -455,7 +459,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"]
|
||||||
requestIdExpirationPeriodMs: (
|
requestIdExpirationPeriodMs: (
|
||||||
if _saml_exiration = process.env["SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"]
|
if _saml_exiration = process.env["SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"]
|
||||||
try
|
try
|
||||||
parseInt(_saml_expiration)
|
parseIntOrFail(_saml_expiration)
|
||||||
catch e
|
catch e
|
||||||
console.error "Cannot parse SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"
|
console.error "Cannot parse SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue