settings.defaults.js 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. let defaultFeatures, docUpdaterPort, siteUrl, v1Api
  2. const http = require('http')
  3. http.globalAgent.maxSockets = 300
  4. // Make time interval config easier.
  5. const seconds = 1000
  6. const minutes = 60 * seconds
  7. // These credentials are used for authenticating api requests
  8. // between services that may need to go over public channels
  9. const httpAuthUser = process.env.WEB_API_USER
  10. const httpAuthPass = process.env.WEB_API_PASSWORD
  11. const httpAuthUsers = {}
  12. if (httpAuthUser && httpAuthPass) {
  13. httpAuthUsers[httpAuthUser] = httpAuthPass
  14. }
  15. const sessionSecret = process.env.SESSION_SECRET || 'secret-please-change'
  16. if (process.env.V1_API_URL || process.env.V1_HOST) {
  17. v1Api = {
  18. url: process.env.V1_API_URL || `http://${process.env.V1_HOST}:5000`,
  19. user: process.env.V1_API_USER,
  20. pass: process.env.V1_API_PASSWORD,
  21. }
  22. } else {
  23. v1Api = {
  24. url: undefined,
  25. user: undefined,
  26. pass: undefined,
  27. }
  28. }
  29. const intFromEnv = function (name, defaultValue) {
  30. if (
  31. [null, undefined].includes(defaultValue) ||
  32. typeof defaultValue !== 'number'
  33. ) {
  34. throw new Error(
  35. `Bad default integer value for setting: ${name}, ${defaultValue}`
  36. )
  37. }
  38. return parseInt(process.env[name], 10) || defaultValue
  39. }
  40. const defaultTextExtensions = [
  41. 'tex',
  42. 'latex',
  43. 'sty',
  44. 'cls',
  45. 'bst',
  46. 'bib',
  47. 'bibtex',
  48. 'txt',
  49. 'tikz',
  50. 'mtx',
  51. 'rtex',
  52. 'md',
  53. 'asy',
  54. 'latexmkrc',
  55. 'lbx',
  56. 'bbx',
  57. 'cbx',
  58. 'm',
  59. 'lco',
  60. 'dtx',
  61. 'ins',
  62. 'ist',
  63. 'def',
  64. 'clo',
  65. 'ldf',
  66. 'rmd',
  67. 'lua',
  68. 'gv',
  69. 'mf',
  70. 'yml',
  71. 'yaml',
  72. ]
  73. const parseTextExtensions = function (extensions) {
  74. if (extensions) {
  75. return extensions.split(',').map(ext => ext.trim())
  76. } else {
  77. return []
  78. }
  79. }
  80. module.exports = {
  81. allowAnonymousReadAndWriteSharing:
  82. process.env.SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING === 'true',
  83. // Databases
  84. // ---------
  85. mongo: {
  86. options: {
  87. appname: 'web',
  88. useUnifiedTopology:
  89. (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
  90. poolSize: parseInt(process.env.MONGO_POOL_SIZE, 10) || 10,
  91. serverSelectionTimeoutMS:
  92. parseInt(process.env.MONGO_SERVER_SELECTION_TIMEOUT, 10) || 60000,
  93. socketTimeoutMS: parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 30000,
  94. },
  95. url:
  96. process.env.MONGO_CONNECTION_STRING ||
  97. process.env.MONGO_URL ||
  98. `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
  99. },
  100. redis: {
  101. web: {
  102. host: process.env.REDIS_HOST || 'localhost',
  103. port: process.env.REDIS_PORT || '6379',
  104. password: process.env.REDIS_PASSWORD || '',
  105. maxRetriesPerRequest: parseInt(
  106. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  107. ),
  108. },
  109. // websessions:
  110. // cluster: [
  111. // {host: 'localhost', port: 7000}
  112. // {host: 'localhost', port: 7001}
  113. // {host: 'localhost', port: 7002}
  114. // {host: 'localhost', port: 7003}
  115. // {host: 'localhost', port: 7004}
  116. // {host: 'localhost', port: 7005}
  117. // ]
  118. // ratelimiter:
  119. // cluster: [
  120. // {host: 'localhost', port: 7000}
  121. // {host: 'localhost', port: 7001}
  122. // {host: 'localhost', port: 7002}
  123. // {host: 'localhost', port: 7003}
  124. // {host: 'localhost', port: 7004}
  125. // {host: 'localhost', port: 7005}
  126. // ]
  127. // cooldown:
  128. // cluster: [
  129. // {host: 'localhost', port: 7000}
  130. // {host: 'localhost', port: 7001}
  131. // {host: 'localhost', port: 7002}
  132. // {host: 'localhost', port: 7003}
  133. // {host: 'localhost', port: 7004}
  134. // {host: 'localhost', port: 7005}
  135. // ]
  136. api: {
  137. host: process.env.REDIS_HOST || 'localhost',
  138. port: process.env.REDIS_PORT || '6379',
  139. password: process.env.REDIS_PASSWORD || '',
  140. maxRetriesPerRequest: parseInt(
  141. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  142. ),
  143. },
  144. queues: {
  145. host: process.env.QUEUES_REDIS_HOST || 'localhost',
  146. port: process.env.QUEUES_REDIS_PORT || '6379',
  147. password: process.env.QUEUES_REDIS_PASSWORD || '',
  148. },
  149. },
  150. // Service locations
  151. // -----------------
  152. // Configure which ports to run each service on. Generally you
  153. // can leave these as they are unless you have some other services
  154. // running which conflict, or want to run the web process on port 80.
  155. internal: {
  156. web: {
  157. port: process.env.WEB_PORT || 3000,
  158. host: process.env.LISTEN_ADDRESS || 'localhost',
  159. },
  160. documentupdater: {
  161. port: (docUpdaterPort = 3003),
  162. },
  163. },
  164. gitBridgePublicBaseUrl: `http://${
  165. process.env.GIT_BRIDGE_HOST || 'localhost'
  166. }:8000`,
  167. // Tell each service where to find the other services. If everything
  168. // is running locally then this is easy, but they exist as separate config
  169. // options incase you want to run some services on remote hosts.
  170. apis: {
  171. web: {
  172. url: `http://${
  173. process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
  174. }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
  175. user: httpAuthUser,
  176. pass: httpAuthPass,
  177. },
  178. documentupdater: {
  179. url: `http://${
  180. process.env.DOCUPDATER_HOST ||
  181. process.env.DOCUMENT_UPDATER_HOST ||
  182. 'localhost'
  183. }:${docUpdaterPort}`,
  184. },
  185. thirdPartyDataStore: {
  186. url: `http://${process.env.TPDS_HOST || 'localhost'}:3002`,
  187. emptyProjectFlushDelayMiliseconds: 5 * seconds,
  188. dropboxApp: process.env.TPDS_DROPBOX_APP,
  189. },
  190. tags: {
  191. url: `http://${process.env.TAGS_HOST || 'localhost'}:3012`,
  192. },
  193. spelling: {
  194. url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
  195. host: process.env.SPELLING_HOST,
  196. },
  197. trackchanges: {
  198. url: `http://${process.env.TRACK_CHANGES_HOST || 'localhost'}:3015`,
  199. },
  200. project_history: {
  201. sendProjectStructureOps:
  202. process.env.PROJECT_HISTORY_ENABLED === 'true' || false,
  203. initializeHistoryForNewProjects:
  204. process.env.PROJECT_HISTORY_ENABLED === 'true' || false,
  205. displayHistoryForNewProjects:
  206. process.env.PROJECT_HISTORY_ENABLED === 'true' || false,
  207. url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
  208. },
  209. docstore: {
  210. url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  211. pubUrl: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  212. },
  213. chat: {
  214. internal_url: `http://${process.env.CHAT_HOST || 'localhost'}:3010`,
  215. },
  216. blog: {
  217. url: 'http://localhost:3008',
  218. port: 3008,
  219. },
  220. university: {
  221. url: 'http://localhost:3011',
  222. },
  223. filestore: {
  224. url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
  225. },
  226. clsi: {
  227. url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
  228. // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
  229. backendGroupName: undefined,
  230. },
  231. templates: {
  232. url: `http://${process.env.TEMPLATES_HOST || 'localhost'}:3007`,
  233. },
  234. githubSync: {
  235. url: `http://${process.env.GITHUB_SYNC_HOST || 'localhost'}:3022`,
  236. },
  237. recurly: {
  238. apiKey: process.env.RECURLY_API_KEY || '',
  239. apiVersion: process.env.RECURLY_API_VERSION,
  240. subdomain: process.env.RECURLY_SUBDOMAIN || '',
  241. publicKey: process.env.RECURLY_PUBLIC_KEY || '',
  242. webhookUser: process.env.RECURLY_WEBHOOK_USER,
  243. webhookPass: process.env.RECURLY_WEBHOOK_PASS,
  244. },
  245. geoIpLookup: {
  246. url: `http://${
  247. process.env.GEOIP_HOST || process.env.FREEGEOIP_HOST || 'localhost'
  248. }:8080/json/`,
  249. },
  250. realTime: {
  251. url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
  252. },
  253. contacts: {
  254. url: `http://${process.env.CONTACTS_HOST || 'localhost'}:3036`,
  255. },
  256. sixpack: {
  257. url: '',
  258. },
  259. references: {
  260. url:
  261. process.env.REFERENCES_HOST != null
  262. ? `http://${process.env.REFERENCES_HOST}:3040`
  263. : undefined,
  264. },
  265. notifications: {
  266. url: `http://${process.env.NOTIFICATIONS_HOST || 'localhost'}:3042`,
  267. },
  268. analytics: {
  269. url: `http://${process.env.ANALYTICS_HOST || 'localhost'}:3050`,
  270. },
  271. linkedUrlProxy: {
  272. url: process.env.LINKED_URL_PROXY,
  273. },
  274. thirdpartyreferences: {
  275. url: `http://${
  276. process.env.THIRD_PARTY_REFERENCES_HOST || 'localhost'
  277. }:3046`,
  278. timeout: parseInt(
  279. process.env.THIRD_PARTY_REFERENCES_TIMEOUT || '30000',
  280. 10
  281. ),
  282. },
  283. v1: {
  284. url: v1Api.url,
  285. user: v1Api.user,
  286. pass: v1Api.pass,
  287. },
  288. v1_history: {
  289. url: `http://${process.env.V1_HISTORY_HOST || 'localhost'}:3100/api`,
  290. user: process.env.V1_HISTORY_USER || 'staging',
  291. pass: process.env.V1_HISTORY_PASSWORD || 'password',
  292. },
  293. },
  294. templates: {
  295. user_id: process.env.TEMPLATES_USER_ID || '5395eb7aad1f29a88756c7f2',
  296. showSocialButtons: false,
  297. showComments: false,
  298. },
  299. splitTests: [
  300. {
  301. id: 'example-project-v2',
  302. active: process.env.SPLITTEST_EXAMPLE_PROJECT_ACTIVE === 'true',
  303. variants: [
  304. {
  305. id: 'example-frog',
  306. rolloutPercent: parseInt(
  307. process.env
  308. .SPLITTEST_EXAMPLE_PROJECT_FROG_VARIANT_ROLLOUT_PERCENT || '0',
  309. 10
  310. ),
  311. },
  312. ],
  313. },
  314. {
  315. id: 'subscription-page',
  316. active: process.env.SPLITTEST_SUBSCRIPTION_PAGE_ACTIVE === 'true',
  317. variants: [
  318. {
  319. id: 'new',
  320. rolloutPercent: parseInt(
  321. process.env
  322. .SPLITTEST_SUBSCRIPTION_PAGE_NEW_VARIANT_ROLLOUT_PERCENT || '0',
  323. 10
  324. ),
  325. },
  326. ],
  327. },
  328. {
  329. id: 'pdf_caching_5',
  330. active: process.env.SPLIT_TEST_PDF_CACHING_5_ACTIVE === 'true',
  331. variants: [
  332. {
  333. id: 'collect-metrics-only',
  334. rolloutPercent: 5,
  335. },
  336. {
  337. id: 'collect-metrics-and-enable-caching',
  338. rolloutPercent: 5,
  339. },
  340. ],
  341. },
  342. ],
  343. // cdn:
  344. // web:
  345. // host:"http://nowhere.sharelatex.dev"
  346. // darkHost:"http://cdn.sharelatex.dev:3000"
  347. // Where your instance of ShareLaTeX can be found publically. Used in emails
  348. // that are sent out, generated links, etc.
  349. siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://localhost:3000'),
  350. lockManager: {
  351. lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),
  352. maxTestInterval: intFromEnv('LOCK_MANAGER_MAX_TEST_INTERVAL', 1000),
  353. maxLockWaitTime: intFromEnv('LOCK_MANAGER_MAX_LOCK_WAIT_TIME', 10000),
  354. redisLockExpiry: intFromEnv('LOCK_MANAGER_REDIS_LOCK_EXPIRY', 30),
  355. slowExecutionThreshold: intFromEnv(
  356. 'LOCK_MANAGER_SLOW_EXECUTION_THRESHOLD',
  357. 5000
  358. ),
  359. },
  360. // Optional separate location for websocket connections, if unset defaults to siteUrl.
  361. wsUrl: process.env.WEBSOCKET_URL,
  362. wsUrlV2: process.env.WEBSOCKET_URL_V2,
  363. wsUrlBeta: process.env.WEBSOCKET_URL_BETA,
  364. wsUrlV2Percentage: parseInt(
  365. process.env.WEBSOCKET_URL_V2_PERCENTAGE || '0',
  366. 10
  367. ),
  368. wsRetryHandshake: parseInt(process.env.WEBSOCKET_RETRY_HANDSHAKE || '5', 10),
  369. // Compile UI rollout percentages
  370. logsUIPercentageBeta: parseInt(
  371. process.env.LOGS_UI_PERCENTAGE_BETA || '0',
  372. 10
  373. ),
  374. logsUIPercentageWithoutPopupBeta: parseInt(
  375. process.env.LOGS_UI_WITHOUT_POPUP_PERCENTAGE_BETA || '0',
  376. 10
  377. ),
  378. logsUIPercentage: parseInt(process.env.LOGS_UI_PERCENTAGE || '0', 10),
  379. logsUIPercentageWithoutPopup: parseInt(
  380. process.env.LOGS_UI_WITHOUT_POPUP_PERCENTAGE || '0',
  381. 10
  382. ),
  383. // cookie domain
  384. // use full domain for cookies to only be accessible from that domain,
  385. // replace subdomain with dot to have them accessible on all subdomains
  386. cookieDomain: process.env.COOKIE_DOMAIN,
  387. cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
  388. // this is only used if cookies are used for clsi backend
  389. // clsiCookieKey: "clsiserver"
  390. // Same, but with http auth credentials.
  391. httpAuthSiteUrl: `http://${httpAuthUser}:${httpAuthPass}@${siteUrl}`,
  392. robotsNoindex: process.env.ROBOTS_NOINDEX === 'true' || false,
  393. maxEntitiesPerProject: 2000,
  394. maxUploadSize: 50 * 1024 * 1024, // 50 MB
  395. // start failing the health check if active handles exceeds this limit
  396. maxActiveHandles: process.env.MAX_ACTIVE_HANDLES
  397. ? parseInt(process.env.MAX_ACTIVE_HANDLES, 10)
  398. : undefined,
  399. // Security
  400. // --------
  401. security: {
  402. sessionSecret,
  403. bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS, 10) || 12,
  404. }, // number of rounds used to hash user passwords (raised to power 2)
  405. httpAuthUsers,
  406. twoFactorAuthentication: {
  407. enabled: process.env.TWO_FACTOR_AUTHENTICATION_ENABLED === 'true',
  408. requiredForStaff:
  409. process.env.TWO_FACTOR_AUTHENTICATION_REQUIRED_FOR_STAFF === 'true',
  410. },
  411. jwt: {
  412. key: process.env.OT_JWT_AUTH_KEY,
  413. algorithm: process.env.OT_JWT_AUTH_ALG || 'HS256',
  414. },
  415. // Default features
  416. // ----------------
  417. //
  418. // You can select the features that are enabled by default for new
  419. // new users.
  420. defaultFeatures: (defaultFeatures = {
  421. collaborators: -1,
  422. dropbox: true,
  423. github: true,
  424. gitBridge: true,
  425. versioning: true,
  426. compileTimeout: 180,
  427. compileGroup: 'standard',
  428. references: true,
  429. templates: true,
  430. trackChanges: true,
  431. }),
  432. features: {
  433. personal: defaultFeatures,
  434. },
  435. plans: [
  436. {
  437. planCode: 'personal',
  438. name: 'Personal',
  439. price: 0,
  440. features: defaultFeatures,
  441. },
  442. ],
  443. enableSubscriptions: false,
  444. enabledLinkedFileTypes: (process.env.ENABLED_LINKED_FILE_TYPES || '').split(
  445. ','
  446. ),
  447. // i18n
  448. // ------
  449. //
  450. i18n: {
  451. checkForHTMLInVars: process.env.I18N_CHECK_FOR_HTML_IN_VARS === 'true',
  452. escapeHTMLInVars: process.env.I18N_ESCAPE_HTML_IN_VARS === 'true',
  453. subdomainLang: {
  454. www: { lngCode: 'en', url: siteUrl },
  455. },
  456. defaultLng: 'en',
  457. },
  458. // Spelling languages
  459. // ------------------
  460. //
  461. // You must have the corresponding aspell package installed to
  462. // be able to use a language.
  463. languages: [
  464. { code: 'en', name: 'English' },
  465. { code: 'en_US', name: 'English (American)' },
  466. { code: 'en_GB', name: 'English (British)' },
  467. { code: 'en_CA', name: 'English (Canadian)' },
  468. { code: 'af', name: 'Afrikaans' },
  469. { code: 'ar', name: 'Arabic' },
  470. { code: 'gl', name: 'Galician' },
  471. { code: 'eu', name: 'Basque' },
  472. { code: 'br', name: 'Breton' },
  473. { code: 'bg', name: 'Bulgarian' },
  474. { code: 'ca', name: 'Catalan' },
  475. { code: 'hr', name: 'Croatian' },
  476. { code: 'cs', name: 'Czech' },
  477. { code: 'da', name: 'Danish' },
  478. { code: 'nl', name: 'Dutch' },
  479. { code: 'eo', name: 'Esperanto' },
  480. { code: 'et', name: 'Estonian' },
  481. { code: 'fo', name: 'Faroese' },
  482. { code: 'fr', name: 'French' },
  483. { code: 'de', name: 'German' },
  484. { code: 'el', name: 'Greek' },
  485. { code: 'id', name: 'Indonesian' },
  486. { code: 'ga', name: 'Irish' },
  487. { code: 'it', name: 'Italian' },
  488. { code: 'kk', name: 'Kazakh' },
  489. { code: 'ku', name: 'Kurdish' },
  490. { code: 'lv', name: 'Latvian' },
  491. { code: 'lt', name: 'Lithuanian' },
  492. { code: 'nr', name: 'Ndebele' },
  493. { code: 'ns', name: 'Northern Sotho' },
  494. { code: 'no', name: 'Norwegian' },
  495. { code: 'fa', name: 'Persian' },
  496. { code: 'pl', name: 'Polish' },
  497. { code: 'pt_BR', name: 'Portuguese (Brazilian)' },
  498. { code: 'pt_PT', name: 'Portuguese (European)' },
  499. { code: 'pa', name: 'Punjabi' },
  500. { code: 'ro', name: 'Romanian' },
  501. { code: 'ru', name: 'Russian' },
  502. { code: 'sk', name: 'Slovak' },
  503. { code: 'sl', name: 'Slovenian' },
  504. { code: 'st', name: 'Southern Sotho' },
  505. { code: 'es', name: 'Spanish' },
  506. { code: 'sv', name: 'Swedish' },
  507. { code: 'tl', name: 'Tagalog' },
  508. { code: 'ts', name: 'Tsonga' },
  509. { code: 'tn', name: 'Tswana' },
  510. { code: 'hsb', name: 'Upper Sorbian' },
  511. { code: 'cy', name: 'Welsh' },
  512. { code: 'xh', name: 'Xhosa' },
  513. ],
  514. // Password Settings
  515. // -----------
  516. // These restrict the passwords users can use when registering
  517. // opts are from http://antelle.github.io/passfield
  518. // passwordStrengthOptions:
  519. // pattern: "aA$3"
  520. // length:
  521. // min: 6
  522. // max: 128
  523. // Email support
  524. // -------------
  525. //
  526. // ShareLaTeX uses nodemailer (http://www.nodemailer.com/) to send transactional emails.
  527. // To see the range of transport and options they support, see http://www.nodemailer.com/docs/transports
  528. // email:
  529. // fromAddress: ""
  530. // replyTo: ""
  531. // lifecycle: false
  532. // # Example transport and parameter settings for Amazon SES
  533. // transport: "SES"
  534. // parameters:
  535. // AWSAccessKeyID: ""
  536. // AWSSecretKey: ""
  537. // Third party services
  538. // --------------------
  539. //
  540. // ShareLaTeX's regular newsletter is managed by mailchimp. Add your
  541. // credentials here to integrate with this.
  542. // mailchimp:
  543. // api_key: ""
  544. // list_id: ""
  545. //
  546. // Fill in your unique token from various analytics services to enable
  547. // them.
  548. // analytics:
  549. // ga:
  550. // token: ""
  551. // gaOptimize:
  552. // id: ""
  553. // ShareLaTeX's help desk is provided by tenderapp.com
  554. // tenderUrl: ""
  555. //
  556. // Client-side error logging is provided by getsentry.com
  557. sentry: {
  558. environment: process.env.SENTRY_ENVIRONMENT,
  559. release: process.env.SENTRY_RELEASE,
  560. },
  561. // publicDSN: ""
  562. // The publicDSN is the token for the client-side getSentry service.
  563. // Production Settings
  564. // -------------------
  565. debugPugTemplates: process.env.DEBUG_PUG_TEMPLATES === 'true',
  566. precompilePugTemplatesAtBootTime: process.env
  567. .PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME
  568. ? process.env.PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME === 'true'
  569. : process.env.NODE_ENV === 'production',
  570. // Should javascript assets be served minified or not. Note that you will
  571. // need to run `grunt compile:minify` within the web-sharelatex directory
  572. // to generate these.
  573. useMinifiedJs: process.env.MINIFIED_JS === 'true' || false,
  574. // Should static assets be sent with a header to tell the browser to cache
  575. // them.
  576. cacheStaticAssets: false,
  577. // If you are running ShareLaTeX over https, set this to true to send the
  578. // cookie with a secure flag (recommended).
  579. secureCookie: false,
  580. // 'SameSite' cookie setting. Can be set to 'lax', 'none' or 'strict'
  581. // 'lax' is recommended, as 'strict' will prevent people linking to projects
  582. // https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
  583. sameSiteCookie: 'lax',
  584. // If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
  585. // then set this to true to allow it to correctly detect the forwarded IP
  586. // address and http/https protocol information.
  587. behindProxy: false,
  588. // Expose the hostname in the `X-Served-By` response header
  589. exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
  590. // Cookie max age (in milliseconds). Set to false for a browser session.
  591. cookieSessionLength: 5 * 24 * 60 * 60 * 1000, // 5 days
  592. // When true, only allow invites to be sent to email addresses that
  593. // already have user accounts
  594. restrictInvitesToExistingAccounts: false,
  595. // Should we allow access to any page without logging in? This includes
  596. // public projects, /learn, /templates, about pages, etc.
  597. allowPublicAccess: process.env.SHARELATEX_ALLOW_PUBLIC_ACCESS === 'true',
  598. enableHomepage: process.env.HOME_PAGE_ENABLED === 'true',
  599. // editor should be open by default
  600. editorIsOpen: process.env.EDITOR_OPEN !== 'false',
  601. // site should be open by default
  602. siteIsOpen: process.env.SITE_OPEN !== 'false',
  603. // Use a single compile directory for all users in a project
  604. // (otherwise each user has their own directory)
  605. // disablePerUserCompiles: true
  606. // Domain the client (pdfjs) should download the compiled pdf from
  607. pdfDownloadDomain: process.env.PDF_DOWNLOAD_DOMAIN, // "http://clsi-lb:3014"
  608. // By default turn on feature flag, can be overridden per request.
  609. enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
  610. // Whether to disable any existing service worker on the next load of the editor
  611. resetServiceWorker: process.env.RESET_SERVICE_WORKER === 'true',
  612. // Maximum size of text documents in the real-time editing system.
  613. max_doc_length: 2 * 1024 * 1024, // 2mb
  614. // Maximum JSON size in HTTP requests
  615. // We should be able to process twice the max doc length, to allow for
  616. // - the doc content
  617. // - text ranges spanning the whole doc
  618. //
  619. // There's also overhead required for the JSON encoding and the UTF-8 encoding,
  620. // theoretically up to 3 times the max doc length. On the other hand, we don't
  621. // want to block the event loop with JSON parsing, so we try to find a
  622. // practical compromise.
  623. max_json_request_size:
  624. parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 6 * 1024 * 1024, // 6 MB
  625. // Internal configs
  626. // ----------------
  627. path: {
  628. // If we ever need to write something to disk (e.g. incoming requests
  629. // that need processing but may be too big for memory, then write
  630. // them to disk here).
  631. dumpFolder: './data/dumpFolder',
  632. uploadFolder: './data/uploads',
  633. },
  634. // Automatic Snapshots
  635. // -------------------
  636. automaticSnapshots: {
  637. // How long should we wait after the user last edited to
  638. // take a snapshot?
  639. waitTimeAfterLastEdit: 5 * minutes,
  640. // Even if edits are still taking place, this is maximum
  641. // time to wait before taking another snapshot.
  642. maxTimeBetweenSnapshots: 30 * minutes,
  643. },
  644. // Smoke test
  645. // ----------
  646. // Provide log in credentials and a project to be able to run
  647. // some basic smoke tests to check the core functionality.
  648. //
  649. smokeTest: {
  650. user: process.env.SMOKE_TEST_USER,
  651. userId: process.env.SMOKE_TEST_USER_ID,
  652. password: process.env.SMOKE_TEST_PASSWORD,
  653. projectId: process.env.SMOKE_TEST_PROJECT_ID,
  654. rateLimitSubject: process.env.SMOKE_TEST_RATE_LIMIT_SUBJECT || '127.0.0.1',
  655. stepTimeout: parseInt(process.env.SMOKE_TEST_STEP_TIMEOUT || '10000', 10),
  656. },
  657. appName: process.env.APP_NAME || 'ShareLaTeX (Community Edition)',
  658. adminEmail: process.env.ADMIN_EMAIL || 'placeholder@example.com',
  659. adminDomains: JSON.parse(process.env.ADMIN_DOMAINS || 'null'),
  660. salesEmail: process.env.SALES_EMAIL || 'placeholder@example.com',
  661. statusPageUrl: process.env.OVERLEAF_STATUS_URL || 'status.overleaf.com',
  662. nav: {
  663. title: 'ShareLaTeX Community Edition',
  664. left_footer: [
  665. {
  666. text:
  667. "Powered by <a href='https://www.sharelatex.com'>ShareLaTeX</a> © 2016",
  668. },
  669. ],
  670. right_footer: [
  671. {
  672. text: "<i class='fa fa-github-square'></i> Fork on Github!",
  673. url: 'https://github.com/sharelatex/sharelatex',
  674. },
  675. ],
  676. showSubscriptionLink: false,
  677. header_extras: [],
  678. },
  679. // Example:
  680. // header_extras: [{text: "Some Page", url: "http://example.com/some/page", class: "subdued"}]
  681. recaptcha: {
  682. disabled: {
  683. invite: true,
  684. login: true,
  685. register: true,
  686. },
  687. },
  688. customisation: {},
  689. // templates: [{
  690. // name : "cv_or_resume",
  691. // url : "/templates/cv"
  692. // }, {
  693. // name : "cover_letter",
  694. // url : "/templates/cover-letters"
  695. // }, {
  696. // name : "journal_article",
  697. // url : "/templates/journals"
  698. // }, {
  699. // name : "presentation",
  700. // url : "/templates/presentations"
  701. // }, {
  702. // name : "thesis",
  703. // url : "/templates/thesis"
  704. // }, {
  705. // name : "bibliographies",
  706. // url : "/templates/bibliographies"
  707. // }, {
  708. // name : "view_all",
  709. // url : "/templates"
  710. // }]
  711. redirects: {
  712. '/templates/index': '/templates/',
  713. },
  714. reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
  715. disableModule: {
  716. 'user-activate': process.env.DISABLE_MODULE_USER_ACTIVATE === 'true',
  717. launchpad: process.env.DISABLE_MODULE_LAUNCHPAD === 'true',
  718. },
  719. domainLicences: [],
  720. sixpack: {
  721. domain: '',
  722. },
  723. // ShareLaTeX Server Pro options (https://www.sharelatex.com/university/onsite.html)
  724. // ----------
  725. // LDAP
  726. // ----------
  727. // Settings below use a working LDAP test server kindly provided by forumsys.com
  728. // When testing with forumsys.com use username = einstein and password = password
  729. // ldap :
  730. // host: 'ldap://ldap.forumsys.com'
  731. // dn: 'uid=:userKey,dc=example,dc=com'
  732. // baseSearch: 'dc=example,dc=com'
  733. // filter: "(uid=:userKey)"
  734. // failMessage: 'LDAP User Fail'
  735. // fieldName: 'LDAP User'
  736. // placeholder: 'email@example.com'
  737. // emailAtt: 'mail'
  738. // anonymous: false
  739. // adminDN: 'cn=read-only-admin,dc=example,dc=com'
  740. // adminPW: 'password'
  741. // starttls: true
  742. // tlsOptions:
  743. // rejectUnauthorized: false
  744. // ca: ['/etc/ldap/ca_certs.pem']
  745. // templateLinks: [{
  746. // name : "CV projects",
  747. // url : "/templates/cv"
  748. // },{
  749. // name : "all projects",
  750. // url: "/templates/all"
  751. // }]
  752. rateLimit: {
  753. autoCompile: {
  754. everyone: process.env.RATE_LIMIT_AUTO_COMPILE_EVERYONE || 100,
  755. standard: process.env.RATE_LIMIT_AUTO_COMPILE_STANDARD || 25,
  756. },
  757. },
  758. analytics: {
  759. enabled: process.env.ANALYTICS_ENABLED === 'true',
  760. },
  761. // currentImage: "texlive-full:2017.1"
  762. // imageRoot: "<DOCKER REPOSITORY ROOT>" # without any trailing slash
  763. compileBodySizeLimitMb: process.env.COMPILE_BODY_SIZE_LIMIT_MB || 5,
  764. textExtensions: defaultTextExtensions.concat(
  765. parseTextExtensions(process.env.ADDITIONAL_TEXT_EXTENSIONS)
  766. ),
  767. validRootDocExtensions: ['tex', 'Rtex', 'ltx'],
  768. emailConfirmationDisabled:
  769. process.env.EMAIL_CONFIRMATION_DISABLED === 'true' || false,
  770. // allowedImageNames: [
  771. // {imageName: 'texlive-full:2017.1', imageDesc: 'TeXLive 2017'}
  772. // {imageName: 'wl_texlive:2018.1', imageDesc: 'Legacy OL TeXLive 2015'}
  773. // {imageName: 'texlive-full:2016.1', imageDesc: 'Legacy SL TeXLive 2016'}
  774. // {imageName: 'texlive-full:2015.1', imageDesc: 'Legacy SL TeXLive 2015'}
  775. // {imageName: 'texlive-full:2014.2', imageDesc: 'Legacy SL TeXLive 2014.2'}
  776. // ]
  777. enabledServices: (process.env.ENABLED_SERVICES || 'web,api')
  778. .split(',')
  779. .map(s => s.trim()),
  780. // module options
  781. // ----------
  782. modules: {
  783. sanitize: {
  784. options: {
  785. allowedTags: [
  786. 'h1',
  787. 'h2',
  788. 'h3',
  789. 'h4',
  790. 'h5',
  791. 'h6',
  792. 'blockquote',
  793. 'p',
  794. 'a',
  795. 'ul',
  796. 'ol',
  797. 'nl',
  798. 'li',
  799. 'b',
  800. 'i',
  801. 'strong',
  802. 'em',
  803. 'strike',
  804. 'code',
  805. 'hr',
  806. 'br',
  807. 'div',
  808. 'table',
  809. 'thead',
  810. 'col',
  811. 'caption',
  812. 'tbody',
  813. 'tr',
  814. 'th',
  815. 'td',
  816. 'tfoot',
  817. 'pre',
  818. 'iframe',
  819. 'img',
  820. 'figure',
  821. 'figcaption',
  822. 'span',
  823. 'source',
  824. 'video',
  825. 'del',
  826. ],
  827. allowedAttributes: {
  828. a: [
  829. 'href',
  830. 'name',
  831. 'target',
  832. 'class',
  833. 'event-tracking',
  834. 'event-tracking-ga',
  835. 'event-tracking-label',
  836. 'event-tracking-trigger',
  837. ],
  838. div: ['class', 'id', 'style'],
  839. h1: ['class', 'id'],
  840. h2: ['class', 'id'],
  841. h3: ['class', 'id'],
  842. h4: ['class', 'id'],
  843. h5: ['class', 'id'],
  844. h6: ['class', 'id'],
  845. col: ['width'],
  846. figure: ['class', 'id', 'style'],
  847. figcaption: ['class', 'id', 'style'],
  848. i: ['aria-hidden', 'aria-label', 'class', 'id'],
  849. iframe: [
  850. 'allowfullscreen',
  851. 'frameborder',
  852. 'height',
  853. 'src',
  854. 'style',
  855. 'width',
  856. ],
  857. img: ['alt', 'class', 'src', 'style'],
  858. source: ['src', 'type'],
  859. span: ['class', 'id', 'style'],
  860. strong: ['style'],
  861. table: ['border', 'class', 'id', 'style'],
  862. td: ['colspan', 'rowspan', 'headers', 'style'],
  863. th: [
  864. 'abbr',
  865. 'headers',
  866. 'colspan',
  867. 'rowspan',
  868. 'scope',
  869. 'sorted',
  870. 'style',
  871. ],
  872. tr: ['class'],
  873. video: ['alt', 'class', 'controls', 'height', 'width'],
  874. },
  875. },
  876. },
  877. },
  878. overleafModuleImports: {
  879. // modules to import (an empty array for each set of modules)
  880. createFileModes: [],
  881. gitBridge: [],
  882. publishModal: [],
  883. tprLinkedFileInfo: [],
  884. tprLinkedFileRefreshError: [],
  885. },
  886. csp: {
  887. percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
  888. enabled: process.env.CSP_ENABLED === 'true',
  889. reportOnly: process.env.CSP_REPORT_ONLY === 'true',
  890. reportPercentage: parseFloat(process.env.CSP_REPORT_PERCENTAGE) || 0,
  891. reportUri: process.env.CSP_REPORT_URI,
  892. exclude: ['app/views/project/editor', 'app/views/project/list'],
  893. },
  894. unsupportedBrowsers: {
  895. ie: '<=11',
  896. },
  897. }