settings.defaults.js 29 KB

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