2015-02-06 12:01:50 -05:00
|
|
|
Path = require('path')
|
|
|
|
|
|
|
|
# These credentials are used for authenticating api requests
|
|
|
|
# between services that may need to go over public channels
|
|
|
|
httpAuthUser = "sharelatex"
|
2020-01-28 01:16:23 -05:00
|
|
|
httpAuthPass = process.env["WEB_API_PASSWORD"]
|
2015-02-06 12:01:50 -05:00
|
|
|
httpAuthUsers = {}
|
|
|
|
httpAuthUsers[httpAuthUser] = httpAuthPass
|
|
|
|
|
2016-06-28 05:07:50 -04:00
|
|
|
parse = (option)->
|
|
|
|
if option?
|
|
|
|
try
|
|
|
|
opt = JSON.parse(option)
|
|
|
|
return opt
|
|
|
|
catch err
|
|
|
|
console.error "problem parsing #{option}, invalid JSON"
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
DATA_DIR = '/var/lib/sharelatex/data'
|
|
|
|
TMP_DIR = '/var/lib/sharelatex/tmp'
|
|
|
|
|
2016-04-06 12:07:59 -04:00
|
|
|
settings =
|
|
|
|
|
2019-08-07 04:47:05 -04:00
|
|
|
brandPrefix: ""
|
|
|
|
|
2017-10-18 08:28:13 -04:00
|
|
|
allowAnonymousReadAndWriteSharing:
|
|
|
|
process.env['SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING'] == 'true'
|
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
# Databases
|
|
|
|
# ---------
|
|
|
|
|
|
|
|
# ShareLaTeX's main persistant data store is MongoDB (http://www.mongodb.org/)
|
|
|
|
# Documentation about the URL connection string format can be found at:
|
|
|
|
#
|
|
|
|
# http://docs.mongodb.org/manual/reference/connection-string/
|
2019-09-10 11:13:17 -04:00
|
|
|
#
|
2015-02-06 12:01:50 -05:00
|
|
|
# The following works out of the box with Mongo's default settings:
|
|
|
|
mongo:
|
2015-02-09 11:18:58 -05:00
|
|
|
url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://dockerhost/sharelatex'
|
2015-02-06 12:01:50 -05:00
|
|
|
|
|
|
|
# Redis is used in ShareLaTeX for high volume queries, like real-time
|
|
|
|
# editing, and session management.
|
|
|
|
#
|
|
|
|
# The following config will work with Redis's default settings:
|
|
|
|
redis:
|
|
|
|
web: redisConfig =
|
2015-02-09 11:18:58 -05:00
|
|
|
host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost"
|
2015-02-06 12:01:50 -05:00
|
|
|
port: process.env["SHARELATEX_REDIS_PORT"] or "6379"
|
|
|
|
password: process.env["SHARELATEX_REDIS_PASS"] or ""
|
2017-01-26 05:27:17 -05:00
|
|
|
key_schema:
|
2017-05-17 10:29:01 -04:00
|
|
|
# document-updater
|
2017-01-26 05:27:17 -05:00
|
|
|
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
|
|
|
|
docLines: ({doc_id}) -> "doclines:#{doc_id}"
|
|
|
|
docOps: ({doc_id}) -> "DocOps:#{doc_id}"
|
|
|
|
docVersion: ({doc_id}) -> "DocVersion:#{doc_id}"
|
2017-02-23 04:47:11 -05:00
|
|
|
docHash: ({doc_id}) -> "DocHash:#{doc_id}"
|
2017-01-26 05:27:17 -05:00
|
|
|
projectKey: ({doc_id}) -> "ProjectId:#{doc_id}"
|
|
|
|
docsInProject: ({project_id}) -> "DocsIn:#{project_id}"
|
|
|
|
ranges: ({doc_id}) -> "Ranges:#{doc_id}"
|
2017-05-17 10:29:01 -04:00
|
|
|
# document-updater:realtime
|
|
|
|
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
|
|
|
# document-updater:history
|
|
|
|
uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}"
|
|
|
|
docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:#{project_id}"
|
|
|
|
# document-updater:lock
|
|
|
|
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
|
|
|
|
# track-changes:lock
|
|
|
|
historyLock: ({doc_id}) -> "HistoryLock:#{doc_id}"
|
|
|
|
historyIndexLock: ({project_id}) -> "HistoryIndexLock:#{project_id}"
|
|
|
|
# track-chanegs:history
|
|
|
|
uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}"
|
|
|
|
docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:#{project_id}"
|
2017-05-18 05:55:41 -04:00
|
|
|
# realtime
|
|
|
|
clientsInProject: ({project_id}) -> "clients_in_project:#{project_id}"
|
|
|
|
connectedUser: ({project_id, client_id})-> "connected_user:#{project_id}:#{client_id}"
|
2017-05-17 10:29:01 -04:00
|
|
|
fairy: redisConfig
|
|
|
|
# track-changes and document-updater
|
|
|
|
realtime: redisConfig
|
|
|
|
documentupdater: redisConfig
|
|
|
|
lock: redisConfig
|
|
|
|
history: redisConfig
|
2017-05-18 05:55:41 -04:00
|
|
|
websessions: redisConfig
|
2020-02-13 05:56:03 -05:00
|
|
|
api: redisConfig
|
|
|
|
pubsub: redisConfig
|
|
|
|
project_history: redisConfig
|
2015-02-06 12:01:50 -05:00
|
|
|
|
|
|
|
# The compile server (the clsi) uses a SQL database to cache files and
|
|
|
|
# meta-data. sqllite is the default, and the load is low enough that this will
|
|
|
|
# be fine in production (we use sqllite at sharelatex.com).
|
|
|
|
#
|
|
|
|
# If you want to configure a different database, see the Sequelize documentation
|
|
|
|
# for available options:
|
|
|
|
#
|
|
|
|
# https://github.com/sequelize/sequelize/wiki/API-Reference-Sequelize#example-usage
|
|
|
|
#
|
|
|
|
mysql:
|
|
|
|
clsi:
|
|
|
|
database: "clsi"
|
|
|
|
username: "clsi"
|
|
|
|
password: ""
|
|
|
|
dialect: "sqlite"
|
|
|
|
storage: Path.join(DATA_DIR, "db.sqlite")
|
|
|
|
|
|
|
|
# File storage
|
|
|
|
# ------------
|
|
|
|
|
|
|
|
# ShareLaTeX can store binary files like images either locally or in Amazon
|
|
|
|
# S3. The default is locally:
|
|
|
|
filestore:
|
2019-09-10 11:13:17 -04:00
|
|
|
backend: "fs"
|
2015-02-06 12:01:50 -05:00
|
|
|
stores:
|
|
|
|
user_files: Path.join(DATA_DIR, "user_files")
|
2016-04-06 12:07:59 -04:00
|
|
|
template_files: Path.join(DATA_DIR, "template_files")
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
# To use Amazon S3 as a storage backend, comment out the above config, and
|
|
|
|
# uncomment the following, filling in your key, secret, and bucket name:
|
|
|
|
#
|
|
|
|
# filestore:
|
|
|
|
# backend: "s3"
|
|
|
|
# stores:
|
|
|
|
# user_files: "BUCKET_NAME"
|
|
|
|
# s3:
|
|
|
|
# key: "AWS_KEY"
|
|
|
|
# secret: "AWS_SECRET"
|
2019-09-10 11:13:17 -04:00
|
|
|
#
|
2015-02-06 12:01:50 -05:00
|
|
|
|
2017-04-05 09:48:36 -04:00
|
|
|
trackchanges:
|
|
|
|
continueOnError: true
|
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
# Local disk caching
|
|
|
|
# ------------------
|
|
|
|
path:
|
|
|
|
# If we ever need to write something to disk (e.g. incoming requests
|
|
|
|
# that need processing but may be too big for memory), then write
|
|
|
|
# them to disk here:
|
|
|
|
dumpFolder: Path.join(TMP_DIR, "dumpFolder")
|
|
|
|
# Where to write uploads before they are processed
|
|
|
|
uploadFolder: Path.join(TMP_DIR, "uploads")
|
|
|
|
# Where to write the project to disk before running LaTeX on it
|
|
|
|
compilesDir: Path.join(DATA_DIR, "compiles")
|
|
|
|
# Where to cache downloaded URLs for the CLSI
|
|
|
|
clsiCacheDir: Path.join(DATA_DIR, "cache")
|
|
|
|
|
|
|
|
# Server Config
|
|
|
|
# -------------
|
|
|
|
|
|
|
|
# Where your instance of ShareLaTeX can be found publicly. This is used
|
|
|
|
# when emails are sent out and in generated links:
|
2015-02-09 11:18:58 -05:00
|
|
|
siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost'
|
2015-03-25 12:28:06 -04:00
|
|
|
|
|
|
|
# The name this is used to describe your ShareLaTeX Installation
|
|
|
|
appName: process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX (Community Edition)"
|
|
|
|
|
2016-12-20 05:28:54 -05:00
|
|
|
restrictInvitesToExistingAccounts: process.env["SHARELATEX_RESTRICT_INVITES_TO_EXISTING_ACCOUNTS"] == 'true'
|
2016-04-06 12:07:59 -04:00
|
|
|
|
|
|
|
nav:
|
2016-06-15 12:08:48 -04:00
|
|
|
title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Community Edition"
|
2016-04-06 12:07:59 -04:00
|
|
|
|
|
|
|
|
2015-03-25 12:28:06 -04:00
|
|
|
# The email address which users will be directed to as the main point of
|
|
|
|
# contact for this installation of ShareLaTeX.
|
|
|
|
adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] or "placeholder@example.com"
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
# If provided, a sessionSecret is used to sign cookies so that they cannot be
|
|
|
|
# spoofed. This is recommended.
|
|
|
|
security:
|
2020-01-28 01:16:23 -05:00
|
|
|
sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or process.env["CRYPTO_RANDOM"]
|
2015-02-06 12:01:50 -05:00
|
|
|
|
|
|
|
# These credentials are used for authenticating api requests
|
|
|
|
# between services that may need to go over public channels
|
|
|
|
httpAuthUsers: httpAuthUsers
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2019-09-04 10:39:47 -04:00
|
|
|
# Should javascript assets be served minified or not.
|
2019-09-03 05:36:39 -04:00
|
|
|
useMinifiedJs: true
|
2015-02-06 12:01:50 -05:00
|
|
|
|
|
|
|
# Should static assets be sent with a header to tell the browser to cache
|
|
|
|
# them. This should be false in development where changes are being made,
|
|
|
|
# but should be set to true in production.
|
|
|
|
cacheStaticAssets: true
|
|
|
|
|
|
|
|
# If you are running ShareLaTeX over https, set this to true to send the
|
|
|
|
# cookie with a secure flag (recommended).
|
|
|
|
secureCookie: process.env["SHARELATEX_SECURE_COOKIE"]?
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
# 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
|
|
|
|
# address and http/https protocol information.
|
2016-06-09 11:21:54 -04:00
|
|
|
|
2016-06-09 13:29:27 -04:00
|
|
|
behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false
|
2015-02-06 12:01:50 -05:00
|
|
|
|
2017-01-04 06:41:38 -05:00
|
|
|
i18n:
|
|
|
|
subdomainLang:
|
|
|
|
www: {lngCode:process.env["SHARELATEX_SITE_LANGUAGE"] or "en", url: siteUrl}
|
|
|
|
defaultLng: process.env["SHARELATEX_SITE_LANGUAGE"] or "en"
|
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
apis:
|
|
|
|
web:
|
|
|
|
url: "http://localhost:3000"
|
|
|
|
user: httpAuthUser
|
|
|
|
pass: httpAuthPass
|
2019-10-15 05:00:38 -04:00
|
|
|
project_history:
|
|
|
|
enabled: false
|
2016-08-04 09:19:33 -04:00
|
|
|
references:{}
|
2016-06-24 09:06:50 -04:00
|
|
|
notifications:undefined
|
|
|
|
|
2016-11-08 17:37:31 -05:00
|
|
|
defaultFeatures:
|
|
|
|
collaborators: -1
|
|
|
|
dropbox: true
|
|
|
|
versioning: true
|
|
|
|
compileTimeout: 180
|
|
|
|
compileGroup: "standard"
|
2018-01-26 04:43:43 -05:00
|
|
|
trackChanges: true
|
2016-11-08 17:37:31 -05:00
|
|
|
templates: true
|
2018-01-26 04:43:43 -05:00
|
|
|
references: true
|
2016-04-06 12:07:59 -04:00
|
|
|
|
2016-12-21 09:57:47 -05:00
|
|
|
## OPTIONAL CONFIGERABLE SETTINGS
|
2016-04-06 12:07:59 -04:00
|
|
|
|
2016-06-09 13:29:27 -04:00
|
|
|
if process.env["SHARELATEX_LEFT_FOOTER"]?
|
2016-06-17 08:05:03 -04:00
|
|
|
try
|
|
|
|
settings.nav.left_footer = JSON.parse(process.env["SHARELATEX_LEFT_FOOTER"])
|
|
|
|
catch e
|
|
|
|
console.error("could not parse SHARELATEX_LEFT_FOOTER, not valid JSON")
|
2016-06-09 13:29:27 -04:00
|
|
|
|
|
|
|
if process.env["SHARELATEX_RIGHT_FOOTER"]?
|
2016-06-17 08:05:03 -04:00
|
|
|
settings.nav.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"]
|
|
|
|
try
|
|
|
|
settings.nav.right_footer = JSON.parse(process.env["SHARELATEX_RIGHT_FOOTER"])
|
|
|
|
catch e
|
|
|
|
console.error("could not parse SHARELATEX_RIGHT_FOOTER, not valid JSON")
|
2016-06-22 06:47:17 -04:00
|
|
|
|
|
|
|
if process.env["SHARELATEX_HEADER_IMAGE_URL"]?
|
|
|
|
settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"]
|
2016-12-21 09:57:47 -05:00
|
|
|
|
|
|
|
if process.env["SHARELATEX_HEADER_NAV_LINKS"]?
|
2017-01-12 08:51:10 -05:00
|
|
|
console.error """
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
#
|
|
|
|
# WARNING: SHARELATEX_HEADER_NAV_LINKS is no longer supported
|
|
|
|
# See https://github.com/sharelatex/sharelatex/wiki/Configuring-Headers,-Footers-&-Logo
|
|
|
|
#
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
"""
|
|
|
|
|
|
|
|
if process.env["SHARELATEX_HEADER_EXTRAS"]?
|
2016-12-21 09:57:47 -05:00
|
|
|
try
|
2017-01-12 08:51:10 -05:00
|
|
|
settings.nav.header_extras = JSON.parse(process.env["SHARELATEX_HEADER_EXTRAS"])
|
2016-12-21 09:57:47 -05:00
|
|
|
catch e
|
2017-01-12 08:51:10 -05:00
|
|
|
console.error("could not parse SHARELATEX_HEADER_EXTRAS, not valid JSON")
|
|
|
|
|
2016-08-04 09:19:33 -04:00
|
|
|
|
2016-06-09 13:29:27 -04:00
|
|
|
|
2016-04-06 12:07:59 -04:00
|
|
|
# Sending Email
|
|
|
|
# -------------
|
|
|
|
#
|
|
|
|
# You must configure a mail server to be able to send invite emails from
|
|
|
|
# ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer
|
|
|
|
# documentation for available options:
|
|
|
|
#
|
|
|
|
# http://www.nodemailer.com/docs/transports
|
|
|
|
|
|
|
|
|
2016-06-27 09:50:46 -04:00
|
|
|
if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]?
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2016-05-23 08:26:45 -04:00
|
|
|
settings.email =
|
2016-04-06 12:07:59 -04:00
|
|
|
fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]
|
|
|
|
replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or ""
|
2017-06-21 05:59:19 -04:00
|
|
|
driver: process.env["SHARELATEX_EMAIL_DRIVER"]
|
2016-04-06 12:07:59 -04:00
|
|
|
parameters:
|
|
|
|
#AWS Creds
|
|
|
|
AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"]
|
|
|
|
AWSSecretKey: process.env["SHARELATEX_EMAIL_AWS_SES_SECRET_KEY"]
|
|
|
|
|
|
|
|
#SMTP Creds
|
|
|
|
host: process.env["SHARELATEX_EMAIL_SMTP_HOST"]
|
|
|
|
port: process.env["SHARELATEX_EMAIL_SMTP_PORT"],
|
2016-06-28 05:07:50 -04:00
|
|
|
secure: parse(process.env["SHARELATEX_EMAIL_SMTP_SECURE"])
|
|
|
|
ignoreTLS: parse(process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"])
|
|
|
|
|
2016-10-13 09:21:33 -04:00
|
|
|
textEncoding: process.env["SHARELATEX_EMAIL_TEXT_ENCODING"]
|
2016-06-28 12:08:00 -04:00
|
|
|
templates:
|
|
|
|
customFooter: process.env["SHARELATEX_CUSTOM_EMAIL_FOOTER"]
|
|
|
|
|
2016-06-27 10:19:43 -04:00
|
|
|
if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]?
|
|
|
|
settings.email.parameters.auth =
|
|
|
|
user: process.env["SHARELATEX_EMAIL_SMTP_USER"]
|
|
|
|
pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"]
|
|
|
|
|
|
|
|
if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]?
|
|
|
|
settings.email.parameters.tls =
|
2016-06-28 05:07:50 -04:00
|
|
|
rejectUnauthorized: parse(process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"])
|
2017-01-06 06:28:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
# i18n
|
2019-09-10 11:13:17 -04:00
|
|
|
if process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]?
|
2017-01-06 06:28:32 -05:00
|
|
|
|
|
|
|
settings.i18n.subdomainLang = parse(process.env["SHARELATEX_LANG_DOMAIN_MAPPING"])
|
2016-04-06 12:07:59 -04:00
|
|
|
|
|
|
|
# Password Settings
|
|
|
|
# -----------
|
|
|
|
# These restrict the passwords users can use when registering
|
|
|
|
# opts are from http://antelle.github.io/passfield
|
|
|
|
if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"]
|
|
|
|
|
2016-05-23 08:26:45 -04:00
|
|
|
settings.passwordStrengthOptions =
|
2016-04-06 12:07:59 -04:00
|
|
|
pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3"
|
2017-01-04 06:41:38 -05:00
|
|
|
length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 150}
|
2016-04-06 12:07:59 -04:00
|
|
|
|
|
|
|
|
2016-05-23 06:30:25 -04:00
|
|
|
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# ShareLaTeX Server Pro
|
|
|
|
#######################
|
|
|
|
|
2016-08-04 09:19:33 -04:00
|
|
|
if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true
|
2017-11-10 09:15:22 -05:00
|
|
|
settings.bypassPercentageRollouts = true
|
2016-08-04 09:19:33 -04:00
|
|
|
settings.apis.references =
|
|
|
|
url: "http://localhost:3040"
|
2016-05-23 06:30:25 -04:00
|
|
|
|
|
|
|
|
2016-12-09 04:22:31 -05:00
|
|
|
# LDAP - SERVER PRO ONLY
|
|
|
|
# ----------
|
|
|
|
|
2016-04-06 12:07:59 -04:00
|
|
|
if process.env["SHARELATEX_LDAP_HOST"]
|
2016-12-09 04:22:31 -05:00
|
|
|
console.error """
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
#
|
|
|
|
# WARNING: The LDAP configuration format has changed in version 0.5.1
|
|
|
|
# See https://github.com/sharelatex/sharelatex/wiki/Server-Pro:-LDAP-Config
|
|
|
|
#
|
|
|
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
|
|
"""
|
|
|
|
|
|
|
|
if process.env["SHARELATEX_LDAP_URL"]
|
2016-10-21 10:43:58 -04:00
|
|
|
settings.externalAuth = true
|
2016-05-23 08:26:45 -04:00
|
|
|
settings.ldap =
|
2016-12-09 06:01:01 -05:00
|
|
|
emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"]
|
|
|
|
nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"]
|
|
|
|
lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"]
|
|
|
|
updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true'
|
|
|
|
placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"]
|
2016-12-09 04:22:31 -05:00
|
|
|
server:
|
|
|
|
url: process.env["SHARELATEX_LDAP_URL"]
|
|
|
|
bindDn: process.env["SHARELATEX_LDAP_BIND_DN"]
|
|
|
|
bindCredentials: process.env["SHARELATEX_LDAP_BIND_CREDENTIALS"]
|
|
|
|
bindProperty: process.env["SHARELATEX_LDAP_BIND_PROPERTY"]
|
2016-12-09 07:34:08 -05:00
|
|
|
searchBase: process.env["SHARELATEX_LDAP_SEARCH_BASE"]
|
2016-12-09 04:22:31 -05:00
|
|
|
searchScope: process.env["SHARELATEX_LDAP_SEARCH_SCOPE"]
|
|
|
|
searchFilter: process.env["SHARELATEX_LDAP_SEARCH_FILTER"]
|
|
|
|
searchAttributes: (
|
|
|
|
if _ldap_search_attribs = process.env["SHARELATEX_LDAP_SEARCH_ATTRIBUTES"]
|
|
|
|
try
|
|
|
|
JSON.parse(_ldap_search_attribs)
|
2016-12-09 06:13:20 -05:00
|
|
|
catch e
|
2016-12-09 04:22:31 -05:00
|
|
|
console.error "could not parse SHARELATEX_LDAP_SEARCH_ATTRIBUTES"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
groupDnProperty: process.env["SHARELATEX_LDAP_GROUP_DN_PROPERTY"]
|
|
|
|
groupSearchBase: process.env["SHARELATEX_LDAP_GROUP_SEARCH_BASE"]
|
|
|
|
groupSearchScope: process.env["SHARELATEX_LDAP_GROUP_SEARCH_SCOPE"]
|
2016-12-09 06:01:01 -05:00
|
|
|
groupSearchFilter: process.env["SHARELATEX_LDAP_GROUP_SEARCH_FILTER"]
|
2016-12-09 04:22:31 -05:00
|
|
|
groupSearchAttributes: (
|
|
|
|
if _ldap_group_search_attribs = process.env["SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"]
|
|
|
|
try
|
|
|
|
JSON.parse(_ldap_group_search_attribs)
|
2016-12-09 06:13:20 -05:00
|
|
|
catch e
|
2016-12-09 04:22:31 -05:00
|
|
|
console.error "could not parse SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
cache: process.env["SHARELATEX_LDAP_CACHE"] == 'true'
|
|
|
|
timeout: (
|
|
|
|
if _ldap_timeout = process.env["SHARELATEX_LDAP_TIMEOUT"]
|
|
|
|
try
|
|
|
|
parseInt(_ldap_timeout)
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_LDAP_TIMEOUT"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
connectTimeout: (
|
|
|
|
if _ldap_connect_timeout = process.env["SHARELATEX_LDAP_CONNECT_TIMEOUT"]
|
|
|
|
try
|
|
|
|
parseInt(_ldap_connect_timeout)
|
|
|
|
catch e
|
2016-12-09 07:34:08 -05:00
|
|
|
console.error "Cannot parse SHARELATEX_LDAP_CONNECT_TIMEOUT"
|
2016-12-09 04:22:31 -05:00
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
2016-05-24 07:12:26 -04:00
|
|
|
|
|
|
|
if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]
|
2016-06-22 06:47:17 -04:00
|
|
|
try
|
|
|
|
ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"])
|
|
|
|
catch e
|
|
|
|
console.error "could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON"
|
2016-06-22 06:56:29 -04:00
|
|
|
|
2016-06-22 06:47:17 -04:00
|
|
|
if typeof(ca) == 'string'
|
|
|
|
ca_paths = [ca]
|
2016-11-03 12:28:25 -04:00
|
|
|
else if typeof(ca) == 'object' && ca?.length?
|
2016-06-22 06:47:17 -04:00
|
|
|
ca_paths = ca
|
|
|
|
else
|
|
|
|
console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH"
|
|
|
|
|
2016-12-09 04:22:31 -05:00
|
|
|
settings.ldap.server.tlsOptions =
|
2016-05-24 11:43:08 -04:00
|
|
|
rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true"
|
2016-06-22 06:47:17 -04:00
|
|
|
ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem'
|
2016-04-06 12:07:59 -04:00
|
|
|
|
2016-12-09 04:22:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-14 10:40:18 -05:00
|
|
|
if process.env["SHARELATEX_SAML_ENTRYPOINT"]
|
|
|
|
# NOTE: see https://github.com/bergie/passport-saml/blob/master/README.md for docs of `server` options
|
|
|
|
settings.externalAuth = true
|
|
|
|
settings.saml =
|
2016-12-02 10:12:57 -05:00
|
|
|
updateUserDetailsOnLogin: process.env["SHARELATEX_SAML_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true'
|
2016-11-14 10:46:12 -05:00
|
|
|
identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"]
|
2016-11-23 09:13:37 -05:00
|
|
|
emailField: process.env["SHARELATEX_SAML_EMAIL_FIELD"] || process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"]
|
|
|
|
firstNameField: process.env["SHARELATEX_SAML_FIRST_NAME_FIELD"]
|
|
|
|
lastNameField: process.env["SHARELATEX_SAML_LAST_NAME_FIELD"]
|
2016-11-14 10:40:18 -05:00
|
|
|
server:
|
|
|
|
# strings
|
|
|
|
entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"]
|
|
|
|
callbackUrl: process.env["SHARELATEX_SAML_CALLBACK_URL"]
|
|
|
|
issuer: process.env["SHARELATEX_SAML_ISSUER"]
|
|
|
|
decryptionPvk: process.env["SHARELATEX_SAML_DECRYPTION_PVK"]
|
|
|
|
signatureAlgorithm: process.env["SHARELATEX_SAML_SIGNATURE_ALGORITHM"]
|
|
|
|
identifierFormat: process.env["SHARELATEX_SAML_IDENTIFIER_FORMAT"]
|
|
|
|
attributeConsumingServiceIndex: process.env["SHARELATEX_SAML_ATTRIBUTE_CONSUMING_SERVICE_INDEX"]
|
|
|
|
authnContext: process.env["SHARELATEX_SAML_AUTHN_CONTEXT"]
|
|
|
|
authnRequestBinding: process.env["SHARELATEX_SAML_AUTHN_REQUEST_BINDING"]
|
|
|
|
validateInResponseTo: process.env["SHARELATEX_SAML_VALIDATE_IN_RESPONSE_TO"]
|
|
|
|
cacheProvider: process.env["SHARELATEX_SAML_CACHE_PROVIDER"]
|
|
|
|
logoutUrl: process.env["SHARELATEX_SAML_LOGOUT_URL"]
|
|
|
|
logoutCallbackUrl: process.env["SHARELATEX_SAML_LOGOUT_CALLBACK_URL"]
|
|
|
|
disableRequestedAuthnContext: process.env["SHARELATEX_SAML_DISABLE_REQUESTED_AUTHN_CONTEXT"] == 'true'
|
|
|
|
forceAuthn: process.env["SHARELATEX_SAML_FORCE_AUTHN"] == 'true'
|
|
|
|
skipRequestCompression: process.env["SHARELATEX_SAML_SKIP_REQUEST_COMPRESSION"] == 'true'
|
|
|
|
acceptedClockSkewMs: (
|
|
|
|
if _saml_skew = process.env["SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"]
|
|
|
|
try
|
|
|
|
parseInt(_saml_skew)
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
requestIdExpirationPeriodMs: (
|
|
|
|
if _saml_exiration = process.env["SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"]
|
|
|
|
try
|
|
|
|
parseInt(_saml_expiration)
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
2016-11-14 10:46:12 -05:00
|
|
|
additionalParams: (
|
|
|
|
if _saml_additionalParams = process.env["SHARELATEX_SAML_ADDITIONAL_PARAMS"]
|
|
|
|
try
|
|
|
|
JSON.parse(_saml_additionalParams)
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
additionalAuthorizeParams: (
|
|
|
|
if _saml_additionalAuthorizeParams = process.env["SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"]
|
|
|
|
try
|
|
|
|
JSON.parse(_saml_additionalAuthorizeParams )
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
|
|
|
additionalLogoutParams: (
|
|
|
|
if _saml_additionalLogoutParams = process.env["SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"]
|
|
|
|
try
|
|
|
|
JSON.parse(_saml_additionalLogoutParams )
|
|
|
|
catch e
|
|
|
|
console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"
|
|
|
|
else
|
|
|
|
undefined
|
|
|
|
)
|
2016-11-14 10:40:18 -05:00
|
|
|
|
2019-09-04 10:39:47 -04:00
|
|
|
# SHARELATEX_SAML_CERT cannot be empty
|
2019-09-10 11:13:17 -04:00
|
|
|
# https://github.com/bergie/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102
|
2019-09-04 10:39:47 -04:00
|
|
|
if process.env["SHARELATEX_SAML_CERT"]
|
|
|
|
settings.saml.server.cert = process.env["SHARELATEX_SAML_CERT"]
|
|
|
|
settings.saml.server.privateCert = process.env["SHARELATEX_SAML_PRIVATE_CERT"]
|
2016-11-04 11:14:33 -04:00
|
|
|
|
2016-05-23 06:30:25 -04:00
|
|
|
# Compiler
|
|
|
|
# --------
|
2016-05-31 10:21:26 -04:00
|
|
|
if process.env["SANDBOXED_COMPILES"] == "true"
|
2016-05-24 11:43:08 -04:00
|
|
|
settings.clsi =
|
2019-08-22 10:57:26 -04:00
|
|
|
dockerRunner: true
|
2016-05-23 06:30:25 -04:00
|
|
|
docker:
|
2016-05-27 07:12:28 -04:00
|
|
|
image: process.env["TEX_LIVE_DOCKER_IMAGE"]
|
2016-05-23 06:30:25 -04:00
|
|
|
env:
|
2016-10-03 11:54:11 -04:00
|
|
|
HOME: "/tmp"
|
2016-05-23 06:30:25 -04:00
|
|
|
PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
2016-05-27 10:46:51 -04:00
|
|
|
user: "www-data"
|
2016-05-23 06:30:25 -04:00
|
|
|
|
2016-05-31 10:16:31 -04:00
|
|
|
if !settings.path?
|
|
|
|
settings.path = {}
|
|
|
|
settings.path.synctexBaseDir = () -> "/compile"
|
2017-02-03 09:10:42 -05:00
|
|
|
if process.env['SANDBOXED_COMPILES_SIBLING_CONTAINERS'] == 'true'
|
2019-08-22 10:57:26 -04:00
|
|
|
console.log("Using sibling containers for sandboxed compiles")
|
2017-02-03 09:10:42 -05:00
|
|
|
if process.env['SANDBOXED_COMPILES_HOST_DIR']
|
|
|
|
settings.path.sandboxedCompilesHostDir = process.env['SANDBOXED_COMPILES_HOST_DIR']
|
|
|
|
else
|
|
|
|
console.error('Sibling containers, but SANDBOXED_COMPILES_HOST_DIR not set')
|
2016-05-31 10:16:31 -04:00
|
|
|
|
2016-05-23 06:30:25 -04:00
|
|
|
|
|
|
|
# Templates
|
|
|
|
# ---------
|
|
|
|
if process.env["SHARELATEX_TEMPLATES_USER_ID"]
|
2016-05-24 11:43:08 -04:00
|
|
|
settings.templates =
|
2016-05-23 06:30:25 -04:00
|
|
|
mountPointUrl: "/templates"
|
|
|
|
user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"]
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2016-08-04 09:19:33 -04:00
|
|
|
settings.templateLinks = parse(process.env["SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS"])
|
2016-05-23 06:30:25 -04:00
|
|
|
|
2016-04-06 12:07:59 -04:00
|
|
|
|
2016-06-28 05:07:50 -04:00
|
|
|
# /Learn
|
|
|
|
# -------
|
|
|
|
if process.env["SHARELATEX_PROXY_LEARN"]?
|
|
|
|
settings.proxyLearn = parse(process.env["SHARELATEX_PROXY_LEARN"])
|
2016-04-06 12:07:59 -04:00
|
|
|
|
|
|
|
|
2016-08-04 09:19:33 -04:00
|
|
|
# /References
|
|
|
|
# -----------
|
|
|
|
if process.env["SHARELATEX_ELASTICSEARCH_URL"]?
|
|
|
|
settings.references.elasticsearch =
|
|
|
|
host: process.env["SHARELATEX_ELASTICSEARCH_URL"]
|
2019-09-10 11:13:17 -04:00
|
|
|
|
2015-02-06 12:01:50 -05:00
|
|
|
|
|
|
|
# With lots of incoming and outgoing HTTP connections to different services,
|
|
|
|
# sometimes long running, it is a good idea to increase the default number
|
|
|
|
# of sockets that Node will hold open.
|
|
|
|
http = require('http')
|
|
|
|
http.globalAgent.maxSockets = 300
|
|
|
|
https = require('https')
|
|
|
|
https.globalAgent.maxSockets = 300
|
2016-04-06 12:07:59 -04:00
|
|
|
|
2016-05-23 06:37:58 -04:00
|
|
|
module.exports = settings
|
2016-08-04 09:19:33 -04:00
|
|
|
|