settings.defaults.js 29 KB

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