settings.defaults.js 29 KB

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