settings.defaults.js 28 KB

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