settings.defaults.js 28 KB

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