settings.defaults.js 27 KB

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