decaffeinate: Run post-processing cleanups on coffee files

This commit is contained in:
decaffeinate 2021-07-07 11:39:45 +00:00 committed by Jakob Ackermann
parent 7eeb4557f4
commit c0dd3df094
No known key found for this signature in database
GPG key ID: 30C56800FCA3828A
4 changed files with 160 additions and 135 deletions

View file

@ -1,3 +1,12 @@
/* eslint-disable
camelcase,
no-return-assign,
no-unreachable,
no-unused-vars,
node/handle-callback-err,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from * DS101: Remove unnecessary use of Array.from

View file

@ -1,3 +1,11 @@
/* eslint-disable
camelcase,
no-cond-assign,
no-dupe-keys,
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS205: Consider reworking code to avoid use of IIFEs * DS205: Consider reworking code to avoid use of IIFEs
@ -11,7 +19,7 @@ const Path = require('path');
// These credentials are used for authenticating api requests // These credentials are used for authenticating api requests
// between services that may need to go over public channels // between services that may need to go over public channels
const httpAuthUser = "sharelatex"; const httpAuthUser = "sharelatex";
const httpAuthPass = process.env["WEB_API_PASSWORD"]; const httpAuthPass = process.env.WEB_API_PASSWORD;
const httpAuthUsers = {}; const httpAuthUsers = {};
httpAuthUsers[httpAuthUser] = httpAuthPass; httpAuthUsers[httpAuthUser] = httpAuthPass;
@ -40,13 +48,13 @@ const TMP_DIR = '/var/lib/sharelatex/tmp';
const settings = { const settings = {
clsi: { clsi: {
optimiseInDocker: process.env['OPTIMISE_PDF'] === 'true' optimiseInDocker: process.env.OPTIMISE_PDF === 'true'
}, },
brandPrefix: "", brandPrefix: "",
allowAnonymousReadAndWriteSharing: allowAnonymousReadAndWriteSharing:
process.env['SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING'] === 'true', process.env.SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING === 'true',
// Databases // Databases
// --------- // ---------
@ -58,7 +66,7 @@ const settings = {
// //
// The following works out of the box with Mongo's default settings: // The following works out of the box with Mongo's default settings:
mongo: { mongo: {
url : process.env["SHARELATEX_MONGO_URL"] || 'mongodb://dockerhost/sharelatex' url : process.env.SHARELATEX_MONGO_URL || 'mongodb://dockerhost/sharelatex'
}, },
// Redis is used in ShareLaTeX for high volume queries, like real-time // Redis is used in ShareLaTeX for high volume queries, like real-time
@ -67,9 +75,9 @@ const settings = {
// The following config will work with Redis's default settings: // The following config will work with Redis's default settings:
redis: { redis: {
web: (redisConfig = { web: (redisConfig = {
host: process.env["SHARELATEX_REDIS_HOST"] || "dockerhost", host: process.env.SHARELATEX_REDIS_HOST || "dockerhost",
port: process.env["SHARELATEX_REDIS_PORT"] || "6379", port: process.env.SHARELATEX_REDIS_PORT || "6379",
password: process.env["SHARELATEX_REDIS_PASS"] || undefined, password: process.env.SHARELATEX_REDIS_PASS || undefined,
key_schema: { key_schema: {
// document-updater // document-updater
blockingKey({doc_id}) { return `Blocking:${doc_id}`; }, blockingKey({doc_id}) { return `Blocking:${doc_id}`; },
@ -180,26 +188,26 @@ const settings = {
// Where your instance of ShareLaTeX can be found publicly. This is used // Where your instance of ShareLaTeX can be found publicly. This is used
// when emails are sent out and in generated links: // when emails are sent out and in generated links:
siteUrl: (siteUrl = process.env["SHARELATEX_SITE_URL"] || 'http://localhost'), siteUrl: (siteUrl = process.env.SHARELATEX_SITE_URL || 'http://localhost'),
// The name this is used to describe your ShareLaTeX Installation // The name this is used to describe your ShareLaTeX Installation
appName: process.env["SHARELATEX_APP_NAME"] || "ShareLaTeX (Community Edition)", appName: process.env.SHARELATEX_APP_NAME || "ShareLaTeX (Community Edition)",
restrictInvitesToExistingAccounts: process.env["SHARELATEX_RESTRICT_INVITES_TO_EXISTING_ACCOUNTS"] === 'true', restrictInvitesToExistingAccounts: process.env.SHARELATEX_RESTRICT_INVITES_TO_EXISTING_ACCOUNTS === 'true',
nav: { nav: {
title: process.env["SHARELATEX_NAV_TITLE"] || process.env["SHARELATEX_APP_NAME"] || "ShareLaTeX Community Edition" title: process.env.SHARELATEX_NAV_TITLE || process.env.SHARELATEX_APP_NAME || "ShareLaTeX Community Edition"
}, },
// The email address which users will be directed to as the main point of // The email address which users will be directed to as the main point of
// contact for this installation of ShareLaTeX. // contact for this installation of ShareLaTeX.
adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] || "placeholder@example.com", adminEmail: process.env.SHARELATEX_ADMIN_EMAIL || "placeholder@example.com",
// If provided, a sessionSecret is used to sign cookies so that they cannot be // If provided, a sessionSecret is used to sign cookies so that they cannot be
// spoofed. This is recommended. // spoofed. This is recommended.
security: { security: {
sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] || process.env["CRYPTO_RANDOM"] sessionSecret: process.env.SHARELATEX_SESSION_SECRET || process.env.CRYPTO_RANDOM
}, },
// These credentials are used for authenticating api requests // These credentials are used for authenticating api requests
@ -216,22 +224,22 @@ const settings = {
// If you are running ShareLaTeX over https, set this to true to send the // If you are running ShareLaTeX over https, set this to true to send the
// cookie with a secure flag (recommended). // cookie with a secure flag (recommended).
secureCookie: (process.env["SHARELATEX_SECURE_COOKIE"] != null), secureCookie: (process.env.SHARELATEX_SECURE_COOKIE != null),
// If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) // If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
// then set this to true to allow it to correctly detect the forwarded IP // then set this to true to allow it to correctly detect the forwarded IP
// address and http/https protocol information. // address and http/https protocol information.
behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] || false, behindProxy: process.env.SHARELATEX_BEHIND_PROXY || false,
i18n: { i18n: {
subdomainLang: { subdomainLang: {
www: {lngCode:process.env["SHARELATEX_SITE_LANGUAGE"] || "en", url: siteUrl} www: {lngCode:process.env.SHARELATEX_SITE_LANGUAGE || "en", url: siteUrl}
}, },
defaultLng: process.env["SHARELATEX_SITE_LANGUAGE"] || "en" defaultLng: process.env.SHARELATEX_SITE_LANGUAGE || "en"
}, },
currentImageName: process.env["TEX_LIVE_DOCKER_IMAGE"], currentImageName: process.env.TEX_LIVE_DOCKER_IMAGE,
apis: { apis: {
web: { web: {
@ -250,7 +258,7 @@ const settings = {
collaborators: -1, collaborators: -1,
dropbox: true, dropbox: true,
versioning: true, versioning: true,
compileTimeout: parseIntOrFail(process.env["COMPILE_TIMEOUT"] || 180), compileTimeout: parseIntOrFail(process.env.COMPILE_TIMEOUT || 180),
compileGroup: "standard", compileGroup: "standard",
trackChanges: true, trackChanges: true,
templates: true, templates: true,
@ -260,30 +268,30 @@ const settings = {
// # OPTIONAL CONFIGURABLE SETTINGS // # OPTIONAL CONFIGURABLE SETTINGS
if (process.env["SHARELATEX_LEFT_FOOTER"] != null) { if (process.env.SHARELATEX_LEFT_FOOTER != null) {
try { try {
settings.nav.left_footer = JSON.parse(process.env["SHARELATEX_LEFT_FOOTER"]); settings.nav.left_footer = JSON.parse(process.env.SHARELATEX_LEFT_FOOTER);
} catch (error) { } catch (error) {
e = error; e = error;
console.error("could not parse SHARELATEX_LEFT_FOOTER, not valid JSON"); console.error("could not parse SHARELATEX_LEFT_FOOTER, not valid JSON");
} }
} }
if (process.env["SHARELATEX_RIGHT_FOOTER"] != null) { if (process.env.SHARELATEX_RIGHT_FOOTER != null) {
settings.nav.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"]; settings.nav.right_footer = process.env.SHARELATEX_RIGHT_FOOTER;
try { try {
settings.nav.right_footer = JSON.parse(process.env["SHARELATEX_RIGHT_FOOTER"]); settings.nav.right_footer = JSON.parse(process.env.SHARELATEX_RIGHT_FOOTER);
} catch (error1) { } catch (error1) {
e = error1; e = error1;
console.error("could not parse SHARELATEX_RIGHT_FOOTER, not valid JSON"); console.error("could not parse SHARELATEX_RIGHT_FOOTER, not valid JSON");
} }
} }
if (process.env["SHARELATEX_HEADER_IMAGE_URL"] != null) { if (process.env.SHARELATEX_HEADER_IMAGE_URL != null) {
settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"]; settings.nav.custom_logo = process.env.SHARELATEX_HEADER_IMAGE_URL;
} }
if (process.env["SHARELATEX_HEADER_NAV_LINKS"] != null) { if (process.env.SHARELATEX_HEADER_NAV_LINKS != null) {
console.error(`\ console.error(`\
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
@ -295,9 +303,9 @@ if (process.env["SHARELATEX_HEADER_NAV_LINKS"] != null) {
); );
} }
if (process.env["SHARELATEX_HEADER_EXTRAS"] != null) { if (process.env.SHARELATEX_HEADER_EXTRAS != null) {
try { try {
settings.nav.header_extras = JSON.parse(process.env["SHARELATEX_HEADER_EXTRAS"]); settings.nav.header_extras = JSON.parse(process.env.SHARELATEX_HEADER_EXTRAS);
} catch (error2) { } catch (error2) {
e = error2; e = error2;
console.error("could not parse SHARELATEX_HEADER_EXTRAS, not valid JSON"); console.error("could not parse SHARELATEX_HEADER_EXTRAS, not valid JSON");
@ -316,65 +324,65 @@ if (process.env["SHARELATEX_HEADER_EXTRAS"] != null) {
// http://www.nodemailer.com/docs/transports // http://www.nodemailer.com/docs/transports
if (process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] != null) { if (process.env.SHARELATEX_EMAIL_FROM_ADDRESS != null) {
settings.email = { settings.email = {
fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"], fromAddress: process.env.SHARELATEX_EMAIL_FROM_ADDRESS,
replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] || "", replyTo: process.env.SHARELATEX_EMAIL_REPLY_TO || "",
driver: process.env["SHARELATEX_EMAIL_DRIVER"], driver: process.env.SHARELATEX_EMAIL_DRIVER,
parameters: { parameters: {
// AWS Creds // AWS Creds
AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"], AWSAccessKeyID: process.env.SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID,
AWSSecretKey: process.env["SHARELATEX_EMAIL_AWS_SES_SECRET_KEY"], AWSSecretKey: process.env.SHARELATEX_EMAIL_AWS_SES_SECRET_KEY,
// SMTP Creds // SMTP Creds
host: process.env["SHARELATEX_EMAIL_SMTP_HOST"], host: process.env.SHARELATEX_EMAIL_SMTP_HOST,
port: process.env["SHARELATEX_EMAIL_SMTP_PORT"], port: process.env.SHARELATEX_EMAIL_SMTP_PORT,
secure: parse(process.env["SHARELATEX_EMAIL_SMTP_SECURE"]), secure: parse(process.env.SHARELATEX_EMAIL_SMTP_SECURE),
ignoreTLS: parse(process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"]), ignoreTLS: parse(process.env.SHARELATEX_EMAIL_SMTP_IGNORE_TLS),
name: process.env["SHARELATEX_EMAIL_SMTP_NAME"], name: process.env.SHARELATEX_EMAIL_SMTP_NAME,
logger: process.env["SHARELATEX_EMAIL_SMTP_LOGGER"] === 'true' logger: process.env.SHARELATEX_EMAIL_SMTP_LOGGER === 'true'
}, },
textEncoding: process.env["SHARELATEX_EMAIL_TEXT_ENCODING"], textEncoding: process.env.SHARELATEX_EMAIL_TEXT_ENCODING,
template: { template: {
customFooter: process.env["SHARELATEX_CUSTOM_EMAIL_FOOTER"] customFooter: process.env.SHARELATEX_CUSTOM_EMAIL_FOOTER
} }
}; };
if (process.env["SHARELATEX_EMAIL_AWS_SES_REGION"] != null) { if (process.env.SHARELATEX_EMAIL_AWS_SES_REGION != null) {
settings.email.parameters.region = process.env["SHARELATEX_EMAIL_AWS_SES_REGION"]; settings.email.parameters.region = process.env.SHARELATEX_EMAIL_AWS_SES_REGION;
} }
if ((process.env["SHARELATEX_EMAIL_SMTP_USER"] != null) || (process.env["SHARELATEX_EMAIL_SMTP_PASS"] != null)) { if ((process.env.SHARELATEX_EMAIL_SMTP_USER != null) || (process.env.SHARELATEX_EMAIL_SMTP_PASS != null)) {
settings.email.parameters.auth = { settings.email.parameters.auth = {
user: process.env["SHARELATEX_EMAIL_SMTP_USER"], user: process.env.SHARELATEX_EMAIL_SMTP_USER,
pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] pass: process.env.SHARELATEX_EMAIL_SMTP_PASS
}; };
} }
if (process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"] != null) { if (process.env.SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH != null) {
settings.email.parameters.tls = settings.email.parameters.tls =
{rejectUnauthorized: parse(process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"])}; {rejectUnauthorized: parse(process.env.SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH)};
} }
} }
// i18n // i18n
if (process.env["SHARELATEX_LANG_DOMAIN_MAPPING"] != null) { if (process.env.SHARELATEX_LANG_DOMAIN_MAPPING != null) {
settings.i18n.subdomainLang = parse(process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]); settings.i18n.subdomainLang = parse(process.env.SHARELATEX_LANG_DOMAIN_MAPPING);
} }
// Password Settings // Password Settings
// ----------- // -----------
// These restrict the passwords users can use when registering // These restrict the passwords users can use when registering
// opts are from http://antelle.github.io/passfield // opts are from http://antelle.github.io/passfield
if (process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] || process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] || process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"]) { if (process.env.SHARELATEX_PASSWORD_VALIDATION_PATTERN || process.env.SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH || process.env.SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH) {
settings.passwordStrengthOptions = { settings.passwordStrengthOptions = {
pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] || "aA$3", pattern: process.env.SHARELATEX_PASSWORD_VALIDATION_PATTERN || "aA$3",
length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] || 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] || 150} length: {min:process.env.SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH || 8, max: process.env.SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH || 150}
}; };
} }
@ -385,7 +393,7 @@ if (process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] || process.env["SHAREL
// ShareLaTeX Server Pro // ShareLaTeX Server Pro
// ###################### // ######################
if (parse(process.env["SHARELATEX_IS_SERVER_PRO"]) === true) { if (parse(process.env.SHARELATEX_IS_SERVER_PRO) === true) {
settings.bypassPercentageRollouts = true; settings.bypassPercentageRollouts = true;
settings.apis.references = settings.apis.references =
{url: "http://localhost:3040"}; {url: "http://localhost:3040"};
@ -395,7 +403,7 @@ if (parse(process.env["SHARELATEX_IS_SERVER_PRO"]) === true) {
// LDAP - SERVER PRO ONLY // LDAP - SERVER PRO ONLY
// ---------- // ----------
if (process.env["SHARELATEX_LDAP_HOST"]) { if (process.env.SHARELATEX_LDAP_HOST) {
console.error(`\ console.error(`\
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
@ -407,25 +415,25 @@ if (process.env["SHARELATEX_LDAP_HOST"]) {
); );
} }
if (process.env["SHARELATEX_LDAP_URL"]) { if (process.env.SHARELATEX_LDAP_URL) {
let _ldap_connect_timeout, _ldap_group_search_attribs, _ldap_search_attribs, _ldap_timeout; let _ldap_connect_timeout, _ldap_group_search_attribs, _ldap_search_attribs, _ldap_timeout;
settings.externalAuth = true; settings.externalAuth = true;
settings.ldap = { settings.ldap = {
emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"], emailAtt: process.env.SHARELATEX_LDAP_EMAIL_ATT,
nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"], nameAtt: process.env.SHARELATEX_LDAP_NAME_ATT,
lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"], lastNameAtt: process.env.SHARELATEX_LDAP_LAST_NAME_ATT,
updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] === 'true', updateUserDetailsOnLogin: process.env.SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN === 'true',
placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"], placeholder: process.env.SHARELATEX_LDAP_PLACEHOLDER,
server: { server: {
url: process.env["SHARELATEX_LDAP_URL"], url: process.env.SHARELATEX_LDAP_URL,
bindDn: process.env["SHARELATEX_LDAP_BIND_DN"], bindDn: process.env.SHARELATEX_LDAP_BIND_DN,
bindCredentials: process.env["SHARELATEX_LDAP_BIND_CREDENTIALS"], bindCredentials: process.env.SHARELATEX_LDAP_BIND_CREDENTIALS,
bindProperty: process.env["SHARELATEX_LDAP_BIND_PROPERTY"], bindProperty: process.env.SHARELATEX_LDAP_BIND_PROPERTY,
searchBase: process.env["SHARELATEX_LDAP_SEARCH_BASE"], searchBase: process.env.SHARELATEX_LDAP_SEARCH_BASE,
searchScope: process.env["SHARELATEX_LDAP_SEARCH_SCOPE"], searchScope: process.env.SHARELATEX_LDAP_SEARCH_SCOPE,
searchFilter: process.env["SHARELATEX_LDAP_SEARCH_FILTER"], searchFilter: process.env.SHARELATEX_LDAP_SEARCH_FILTER,
searchAttributes: ( searchAttributes: (
(_ldap_search_attribs = process.env["SHARELATEX_LDAP_SEARCH_ATTRIBUTES"]) ? (_ldap_search_attribs = process.env.SHARELATEX_LDAP_SEARCH_ATTRIBUTES) ?
(() => { try { (() => { try {
return JSON.parse(_ldap_search_attribs); return JSON.parse(_ldap_search_attribs);
} catch (error3) { } catch (error3) {
@ -435,12 +443,12 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
: :
undefined undefined
), ),
groupDnProperty: process.env["SHARELATEX_LDAP_GROUP_DN_PROPERTY"], groupDnProperty: process.env.SHARELATEX_LDAP_GROUP_DN_PROPERTY,
groupSearchBase: process.env["SHARELATEX_LDAP_GROUP_SEARCH_BASE"], groupSearchBase: process.env.SHARELATEX_LDAP_GROUP_SEARCH_BASE,
groupSearchScope: process.env["SHARELATEX_LDAP_GROUP_SEARCH_SCOPE"], groupSearchScope: process.env.SHARELATEX_LDAP_GROUP_SEARCH_SCOPE,
groupSearchFilter: process.env["SHARELATEX_LDAP_GROUP_SEARCH_FILTER"], groupSearchFilter: process.env.SHARELATEX_LDAP_GROUP_SEARCH_FILTER,
groupSearchAttributes: ( groupSearchAttributes: (
(_ldap_group_search_attribs = process.env["SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"]) ? (_ldap_group_search_attribs = process.env.SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES) ?
(() => { try { (() => { try {
return JSON.parse(_ldap_group_search_attribs); return JSON.parse(_ldap_group_search_attribs);
} catch (error4) { } catch (error4) {
@ -450,9 +458,9 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
: :
undefined undefined
), ),
cache: process.env["SHARELATEX_LDAP_CACHE"] === 'true', cache: process.env.SHARELATEX_LDAP_CACHE === 'true',
timeout: ( timeout: (
(_ldap_timeout = process.env["SHARELATEX_LDAP_TIMEOUT"]) ? (_ldap_timeout = process.env.SHARELATEX_LDAP_TIMEOUT) ?
(() => { try { (() => { try {
return parseIntOrFail(_ldap_timeout); return parseIntOrFail(_ldap_timeout);
} catch (error5) { } catch (error5) {
@ -463,7 +471,7 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
undefined undefined
), ),
connectTimeout: ( connectTimeout: (
(_ldap_connect_timeout = process.env["SHARELATEX_LDAP_CONNECT_TIMEOUT"]) ? (_ldap_connect_timeout = process.env.SHARELATEX_LDAP_CONNECT_TIMEOUT) ?
(() => { try { (() => { try {
return parseIntOrFail(_ldap_connect_timeout); return parseIntOrFail(_ldap_connect_timeout);
} catch (error6) { } catch (error6) {
@ -476,10 +484,10 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
} }
}; };
if (process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]) { if (process.env.SHARELATEX_LDAP_TLS_OPTS_CA_PATH) {
let ca, ca_paths; let ca, ca_paths;
try { try {
ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]); ca = JSON.parse(process.env.SHARELATEX_LDAP_TLS_OPTS_CA_PATH);
} catch (error7) { } catch (error7) {
e = error7; e = error7;
console.error("could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON"); console.error("could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON");
@ -494,7 +502,7 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
} }
settings.ldap.server.tlsOptions = { settings.ldap.server.tlsOptions = {
rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] === "true", rejectUnauthorized: process.env.SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH === "true",
ca:ca_paths // e.g.'/etc/ldap/ca_certs.pem' ca:ca_paths // e.g.'/etc/ldap/ca_certs.pem'
}; };
} }
@ -504,37 +512,37 @@ if (process.env["SHARELATEX_LDAP_URL"]) {
if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) { if (process.env.SHARELATEX_SAML_ENTRYPOINT) {
// NOTE: see https://github.com/node-saml/passport-saml/blob/master/README.md for docs of `server` options // NOTE: see https://github.com/node-saml/passport-saml/blob/master/README.md for docs of `server` options
let _saml_additionalAuthorizeParams, _saml_additionalLogoutParams, _saml_additionalParams, _saml_expiration, _saml_skew; let _saml_additionalAuthorizeParams, _saml_additionalLogoutParams, _saml_additionalParams, _saml_expiration, _saml_skew;
settings.externalAuth = true; settings.externalAuth = true;
settings.saml = { settings.saml = {
updateUserDetailsOnLogin: process.env["SHARELATEX_SAML_UPDATE_USER_DETAILS_ON_LOGIN"] === 'true', updateUserDetailsOnLogin: process.env.SHARELATEX_SAML_UPDATE_USER_DETAILS_ON_LOGIN === 'true',
identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"], identityServiceName: process.env.SHARELATEX_SAML_IDENTITY_SERVICE_NAME,
emailField: process.env["SHARELATEX_SAML_EMAIL_FIELD"] || process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"], emailField: process.env.SHARELATEX_SAML_EMAIL_FIELD || process.env.SHARELATEX_SAML_EMAIL_FIELD_NAME,
firstNameField: process.env["SHARELATEX_SAML_FIRST_NAME_FIELD"], firstNameField: process.env.SHARELATEX_SAML_FIRST_NAME_FIELD,
lastNameField: process.env["SHARELATEX_SAML_LAST_NAME_FIELD"], lastNameField: process.env.SHARELATEX_SAML_LAST_NAME_FIELD,
server: { server: {
// strings // strings
entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"], entryPoint: process.env.SHARELATEX_SAML_ENTRYPOINT,
callbackUrl: process.env["SHARELATEX_SAML_CALLBACK_URL"], callbackUrl: process.env.SHARELATEX_SAML_CALLBACK_URL,
issuer: process.env["SHARELATEX_SAML_ISSUER"], issuer: process.env.SHARELATEX_SAML_ISSUER,
decryptionPvk: process.env["SHARELATEX_SAML_DECRYPTION_PVK"], decryptionPvk: process.env.SHARELATEX_SAML_DECRYPTION_PVK,
decryptionCert: process.env["SHARELATEX_SAML_DECRYPTION_CERT"], decryptionCert: process.env.SHARELATEX_SAML_DECRYPTION_CERT,
signatureAlgorithm: process.env["SHARELATEX_SAML_SIGNATURE_ALGORITHM"], signatureAlgorithm: process.env.SHARELATEX_SAML_SIGNATURE_ALGORITHM,
identifierFormat: process.env["SHARELATEX_SAML_IDENTIFIER_FORMAT"], identifierFormat: process.env.SHARELATEX_SAML_IDENTIFIER_FORMAT,
attributeConsumingServiceIndex: process.env["SHARELATEX_SAML_ATTRIBUTE_CONSUMING_SERVICE_INDEX"], attributeConsumingServiceIndex: process.env.SHARELATEX_SAML_ATTRIBUTE_CONSUMING_SERVICE_INDEX,
authnContext: process.env["SHARELATEX_SAML_AUTHN_CONTEXT"], authnContext: process.env.SHARELATEX_SAML_AUTHN_CONTEXT,
authnRequestBinding: process.env["SHARELATEX_SAML_AUTHN_REQUEST_BINDING"], authnRequestBinding: process.env.SHARELATEX_SAML_AUTHN_REQUEST_BINDING,
validateInResponseTo: process.env["SHARELATEX_SAML_VALIDATE_IN_RESPONSE_TO"], validateInResponseTo: process.env.SHARELATEX_SAML_VALIDATE_IN_RESPONSE_TO,
cacheProvider: process.env["SHARELATEX_SAML_CACHE_PROVIDER"], cacheProvider: process.env.SHARELATEX_SAML_CACHE_PROVIDER,
logoutUrl: process.env["SHARELATEX_SAML_LOGOUT_URL"], logoutUrl: process.env.SHARELATEX_SAML_LOGOUT_URL,
logoutCallbackUrl: process.env["SHARELATEX_SAML_LOGOUT_CALLBACK_URL"], logoutCallbackUrl: process.env.SHARELATEX_SAML_LOGOUT_CALLBACK_URL,
disableRequestedAuthnContext: process.env["SHARELATEX_SAML_DISABLE_REQUESTED_AUTHN_CONTEXT"] === 'true', disableRequestedAuthnContext: process.env.SHARELATEX_SAML_DISABLE_REQUESTED_AUTHN_CONTEXT === 'true',
forceAuthn: process.env["SHARELATEX_SAML_FORCE_AUTHN"] === 'true', forceAuthn: process.env.SHARELATEX_SAML_FORCE_AUTHN === 'true',
skipRequestCompression: process.env["SHARELATEX_SAML_SKIP_REQUEST_COMPRESSION"] === 'true', skipRequestCompression: process.env.SHARELATEX_SAML_SKIP_REQUEST_COMPRESSION === 'true',
acceptedClockSkewMs: ( acceptedClockSkewMs: (
(_saml_skew = process.env["SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"]) ? (_saml_skew = process.env.SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS) ?
(() => { try { (() => { try {
return parseIntOrFail(_saml_skew); return parseIntOrFail(_saml_skew);
} catch (error8) { } catch (error8) {
@ -545,7 +553,7 @@ if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) {
undefined undefined
), ),
requestIdExpirationPeriodMs: ( requestIdExpirationPeriodMs: (
(_saml_expiration = process.env["SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"]) ? (_saml_expiration = process.env.SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS) ?
(() => { try { (() => { try {
return parseIntOrFail(_saml_expiration); return parseIntOrFail(_saml_expiration);
} catch (error9) { } catch (error9) {
@ -556,7 +564,7 @@ if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) {
undefined undefined
), ),
additionalParams: ( additionalParams: (
(_saml_additionalParams = process.env["SHARELATEX_SAML_ADDITIONAL_PARAMS"]) ? (_saml_additionalParams = process.env.SHARELATEX_SAML_ADDITIONAL_PARAMS) ?
(() => { try { (() => { try {
return JSON.parse(_saml_additionalParams); return JSON.parse(_saml_additionalParams);
} catch (error10) { } catch (error10) {
@ -567,7 +575,7 @@ if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) {
undefined undefined
), ),
additionalAuthorizeParams: ( additionalAuthorizeParams: (
(_saml_additionalAuthorizeParams = process.env["SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"]) ? (_saml_additionalAuthorizeParams = process.env.SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS) ?
(() => { try { (() => { try {
return JSON.parse(_saml_additionalAuthorizeParams ); return JSON.parse(_saml_additionalAuthorizeParams );
} catch (error11) { } catch (error11) {
@ -578,7 +586,7 @@ if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) {
undefined undefined
), ),
additionalLogoutParams: ( additionalLogoutParams: (
(_saml_additionalLogoutParams = process.env["SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"]) ? (_saml_additionalLogoutParams = process.env.SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS) ?
(() => { try { (() => { try {
return JSON.parse(_saml_additionalLogoutParams ); return JSON.parse(_saml_additionalLogoutParams );
} catch (error12) { } catch (error12) {
@ -593,22 +601,22 @@ if (process.env["SHARELATEX_SAML_ENTRYPOINT"]) {
// SHARELATEX_SAML_CERT cannot be empty // SHARELATEX_SAML_CERT cannot be empty
// https://github.com/node-saml/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102 // https://github.com/node-saml/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102
if (process.env["SHARELATEX_SAML_CERT"]) { if (process.env.SHARELATEX_SAML_CERT) {
settings.saml.server.cert = process.env["SHARELATEX_SAML_CERT"]; settings.saml.server.cert = process.env.SHARELATEX_SAML_CERT;
settings.saml.server.privateCert = process.env["SHARELATEX_SAML_PRIVATE_CERT"]; settings.saml.server.privateCert = process.env.SHARELATEX_SAML_PRIVATE_CERT;
} }
} }
// Compiler // Compiler
// -------- // --------
if (process.env["SANDBOXED_COMPILES"] === "true") { if (process.env.SANDBOXED_COMPILES === "true") {
settings.clsi = { settings.clsi = {
dockerRunner: true, dockerRunner: true,
docker: { docker: {
image: process.env["TEX_LIVE_DOCKER_IMAGE"], image: process.env.TEX_LIVE_DOCKER_IMAGE,
env: { env: {
HOME: "/tmp", HOME: "/tmp",
PATH: process.env["COMPILER_PATH"] || "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH: process.env.COMPILER_PATH || "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}, },
user: "www-data" user: "www-data"
} }
@ -618,10 +626,10 @@ if (process.env["SANDBOXED_COMPILES"] === "true") {
settings.path = {}; settings.path = {};
} }
settings.path.synctexBaseDir = () => "/compile"; settings.path.synctexBaseDir = () => "/compile";
if (process.env['SANDBOXED_COMPILES_SIBLING_CONTAINERS'] === 'true') { if (process.env.SANDBOXED_COMPILES_SIBLING_CONTAINERS === 'true') {
console.log("Using sibling containers for sandboxed compiles"); console.log("Using sibling containers for sandboxed compiles");
if (process.env['SANDBOXED_COMPILES_HOST_DIR']) { if (process.env.SANDBOXED_COMPILES_HOST_DIR) {
settings.path.sandboxedCompilesHostDir = process.env['SANDBOXED_COMPILES_HOST_DIR']; settings.path.sandboxedCompilesHostDir = process.env.SANDBOXED_COMPILES_HOST_DIR;
} else { } else {
console.error('Sibling containers, but SANDBOXED_COMPILES_HOST_DIR not set'); console.error('Sibling containers, but SANDBOXED_COMPILES_HOST_DIR not set');
} }
@ -631,37 +639,37 @@ if (process.env["SANDBOXED_COMPILES"] === "true") {
// Templates // Templates
// --------- // ---------
if (process.env["SHARELATEX_TEMPLATES_USER_ID"]) { if (process.env.SHARELATEX_TEMPLATES_USER_ID) {
settings.templates = { settings.templates = {
mountPointUrl: "/templates", mountPointUrl: "/templates",
user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] user_id: process.env.SHARELATEX_TEMPLATES_USER_ID
}; };
settings.templateLinks = parse(process.env["SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS"]); settings.templateLinks = parse(process.env.SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS);
} }
// /Learn // /Learn
// ------- // -------
if (process.env["SHARELATEX_PROXY_LEARN"] != null) { if (process.env.SHARELATEX_PROXY_LEARN != null) {
settings.proxyLearn = parse(process.env["SHARELATEX_PROXY_LEARN"]); settings.proxyLearn = parse(process.env.SHARELATEX_PROXY_LEARN);
} }
// /References // /References
// ----------- // -----------
if (process.env["SHARELATEX_ELASTICSEARCH_URL"] != null) { if (process.env.SHARELATEX_ELASTICSEARCH_URL != null) {
settings.references.elasticsearch = settings.references.elasticsearch =
{host: process.env["SHARELATEX_ELASTICSEARCH_URL"]}; {host: process.env.SHARELATEX_ELASTICSEARCH_URL};
} }
// TeX Live Images // TeX Live Images
// ----------- // -----------
if (process.env["ALL_TEX_LIVE_DOCKER_IMAGES"] != null) { if (process.env.ALL_TEX_LIVE_DOCKER_IMAGES != null) {
allTexLiveDockerImages = process.env["ALL_TEX_LIVE_DOCKER_IMAGES"].split(','); allTexLiveDockerImages = process.env.ALL_TEX_LIVE_DOCKER_IMAGES.split(',');
} }
if (process.env["ALL_TEX_LIVE_DOCKER_IMAGE_NAMES"] != null) { if (process.env.ALL_TEX_LIVE_DOCKER_IMAGE_NAMES != null) {
allTexLiveDockerImageNames = process.env["ALL_TEX_LIVE_DOCKER_IMAGE_NAMES"].split(','); allTexLiveDockerImageNames = process.env.ALL_TEX_LIVE_DOCKER_IMAGE_NAMES.split(',');
} }
if (allTexLiveDockerImages != null) { if (allTexLiveDockerImages != null) {
settings.allowedImageNames = []; settings.allowedImageNames = [];

View file

@ -1,3 +1,9 @@
/* eslint-disable
no-undef,
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns

View file

@ -1,3 +1,5 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
// require("coffee-script") // require("coffee-script")
// fs = require("fs") // fs = require("fs")