settings.defaults.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. const { merge } = require('@overleaf/settings/merge')
  2. let defaultFeatures, siteUrl
  3. // Make time interval config easier.
  4. const seconds = 1000
  5. const minutes = 60 * seconds
  6. // These credentials are used for authenticating api requests
  7. // between services that may need to go over public channels
  8. const httpAuthUser = process.env.WEB_API_USER
  9. const httpAuthPass = process.env.WEB_API_PASSWORD
  10. const httpAuthUsers = {}
  11. if (httpAuthUser && httpAuthPass) {
  12. httpAuthUsers[httpAuthUser] = httpAuthPass
  13. }
  14. const sessionSecret = process.env.SESSION_SECRET || 'secret-please-change'
  15. const intFromEnv = function (name, defaultValue) {
  16. if (
  17. [null, undefined].includes(defaultValue) ||
  18. typeof defaultValue !== 'number'
  19. ) {
  20. throw new Error(
  21. `Bad default integer value for setting: ${name}, ${defaultValue}`
  22. )
  23. }
  24. return parseInt(process.env[name], 10) || defaultValue
  25. }
  26. const defaultTextExtensions = [
  27. 'tex',
  28. 'latex',
  29. 'sty',
  30. 'cls',
  31. 'bst',
  32. 'bib',
  33. 'bibtex',
  34. 'txt',
  35. 'tikz',
  36. 'mtx',
  37. 'rtex',
  38. 'md',
  39. 'asy',
  40. 'latexmkrc',
  41. 'lbx',
  42. 'bbx',
  43. 'cbx',
  44. 'm',
  45. 'lco',
  46. 'dtx',
  47. 'ins',
  48. 'ist',
  49. 'def',
  50. 'clo',
  51. 'ldf',
  52. 'rmd',
  53. 'lua',
  54. 'gv',
  55. 'mf',
  56. 'yml',
  57. 'yaml',
  58. ]
  59. const parseTextExtensions = function (extensions) {
  60. if (extensions) {
  61. return extensions.split(',').map(ext => ext.trim())
  62. } else {
  63. return []
  64. }
  65. }
  66. module.exports = {
  67. env: 'server-ce',
  68. limits: {
  69. httpGlobalAgentMaxSockets: 300,
  70. httpsGlobalAgentMaxSockets: 300,
  71. },
  72. allowAnonymousReadAndWriteSharing:
  73. process.env.SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING === 'true',
  74. // Databases
  75. // ---------
  76. mongo: {
  77. options: {
  78. appname: 'web',
  79. useUnifiedTopology:
  80. (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
  81. poolSize: parseInt(process.env.MONGO_POOL_SIZE, 10) || 10,
  82. serverSelectionTimeoutMS:
  83. parseInt(process.env.MONGO_SERVER_SELECTION_TIMEOUT, 10) || 60000,
  84. socketTimeoutMS: parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 30000,
  85. },
  86. url:
  87. process.env.MONGO_CONNECTION_STRING ||
  88. process.env.MONGO_URL ||
  89. `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
  90. },
  91. redis: {
  92. web: {
  93. host: process.env.REDIS_HOST || 'localhost',
  94. port: process.env.REDIS_PORT || '6379',
  95. password: process.env.REDIS_PASSWORD || '',
  96. maxRetriesPerRequest: parseInt(
  97. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  98. ),
  99. },
  100. // websessions:
  101. // cluster: [
  102. // {host: 'localhost', port: 7000}
  103. // {host: 'localhost', port: 7001}
  104. // {host: 'localhost', port: 7002}
  105. // {host: 'localhost', port: 7003}
  106. // {host: 'localhost', port: 7004}
  107. // {host: 'localhost', port: 7005}
  108. // ]
  109. // ratelimiter:
  110. // cluster: [
  111. // {host: 'localhost', port: 7000}
  112. // {host: 'localhost', port: 7001}
  113. // {host: 'localhost', port: 7002}
  114. // {host: 'localhost', port: 7003}
  115. // {host: 'localhost', port: 7004}
  116. // {host: 'localhost', port: 7005}
  117. // ]
  118. // cooldown:
  119. // cluster: [
  120. // {host: 'localhost', port: 7000}
  121. // {host: 'localhost', port: 7001}
  122. // {host: 'localhost', port: 7002}
  123. // {host: 'localhost', port: 7003}
  124. // {host: 'localhost', port: 7004}
  125. // {host: 'localhost', port: 7005}
  126. // ]
  127. api: {
  128. host: process.env.REDIS_HOST || 'localhost',
  129. port: process.env.REDIS_PORT || '6379',
  130. password: process.env.REDIS_PASSWORD || '',
  131. maxRetriesPerRequest: parseInt(
  132. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  133. ),
  134. },
  135. },
  136. // Service locations
  137. // -----------------
  138. // Configure which ports to run each service on. Generally you
  139. // can leave these as they are unless you have some other services
  140. // running which conflict, or want to run the web process on port 80.
  141. internal: {
  142. web: {
  143. port: process.env.WEB_PORT || 3000,
  144. host: process.env.LISTEN_ADDRESS || 'localhost',
  145. },
  146. },
  147. // Tell each service where to find the other services. If everything
  148. // is running locally then this is easy, but they exist as separate config
  149. // options incase you want to run some services on remote hosts.
  150. apis: {
  151. web: {
  152. url: `http://${
  153. process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
  154. }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
  155. user: httpAuthUser,
  156. pass: httpAuthPass,
  157. },
  158. documentupdater: {
  159. url: `http://${
  160. process.env.DOCUPDATER_HOST ||
  161. process.env.DOCUMENT_UPDATER_HOST ||
  162. 'localhost'
  163. }:3003`,
  164. },
  165. spelling: {
  166. url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
  167. host: process.env.SPELLING_HOST,
  168. },
  169. trackchanges: {
  170. url: `http://${process.env.TRACK_CHANGES_HOST || 'localhost'}:3015`,
  171. },
  172. docstore: {
  173. url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  174. pubUrl: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  175. },
  176. chat: {
  177. internal_url: `http://${process.env.CHAT_HOST || 'localhost'}:3010`,
  178. },
  179. filestore: {
  180. url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
  181. },
  182. clsi: {
  183. url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
  184. // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
  185. backendGroupName: undefined,
  186. },
  187. realTime: {
  188. url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
  189. },
  190. contacts: {
  191. url: `http://${process.env.CONTACTS_HOST || 'localhost'}:3036`,
  192. },
  193. notifications: {
  194. url: `http://${process.env.NOTIFICATIONS_HOST || 'localhost'}:3042`,
  195. },
  196. webpack: {
  197. url: `http://${process.env.WEBPACK_HOST || 'localhost'}:3808`,
  198. },
  199. // For legacy reasons, we need to populate the below objects.
  200. v1: {},
  201. recurly: {},
  202. },
  203. splitTests: [],
  204. // Where your instance of ShareLaTeX can be found publically. Used in emails
  205. // that are sent out, generated links, etc.
  206. siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://localhost:3000'),
  207. lockManager: {
  208. lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),
  209. maxTestInterval: intFromEnv('LOCK_MANAGER_MAX_TEST_INTERVAL', 1000),
  210. maxLockWaitTime: intFromEnv('LOCK_MANAGER_MAX_LOCK_WAIT_TIME', 10000),
  211. redisLockExpiry: intFromEnv('LOCK_MANAGER_REDIS_LOCK_EXPIRY', 30),
  212. slowExecutionThreshold: intFromEnv(
  213. 'LOCK_MANAGER_SLOW_EXECUTION_THRESHOLD',
  214. 5000
  215. ),
  216. },
  217. // Optional separate location for websocket connections, if unset defaults to siteUrl.
  218. wsUrl: process.env.WEBSOCKET_URL,
  219. wsUrlV2: process.env.WEBSOCKET_URL_V2,
  220. wsUrlBeta: process.env.WEBSOCKET_URL_BETA,
  221. wsUrlV2Percentage: parseInt(
  222. process.env.WEBSOCKET_URL_V2_PERCENTAGE || '0',
  223. 10
  224. ),
  225. wsRetryHandshake: parseInt(process.env.WEBSOCKET_RETRY_HANDSHAKE || '5', 10),
  226. // cookie domain
  227. // use full domain for cookies to only be accessible from that domain,
  228. // replace subdomain with dot to have them accessible on all subdomains
  229. cookieDomain: process.env.COOKIE_DOMAIN,
  230. cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
  231. // this is only used if cookies are used for clsi backend
  232. // clsiCookieKey: "clsiserver"
  233. robotsNoindex: process.env.ROBOTS_NOINDEX === 'true' || false,
  234. maxEntitiesPerProject: 2000,
  235. maxUploadSize: 50 * 1024 * 1024, // 50 MB
  236. // start failing the health check if active handles exceeds this limit
  237. maxActiveHandles: process.env.MAX_ACTIVE_HANDLES
  238. ? parseInt(process.env.MAX_ACTIVE_HANDLES, 10)
  239. : undefined,
  240. // Security
  241. // --------
  242. security: {
  243. sessionSecret,
  244. bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS, 10) || 12,
  245. }, // number of rounds used to hash user passwords (raised to power 2)
  246. httpAuthUsers,
  247. // Default features
  248. // ----------------
  249. //
  250. // You can select the features that are enabled by default for new
  251. // new users.
  252. defaultFeatures: (defaultFeatures = {
  253. collaborators: -1,
  254. dropbox: true,
  255. github: true,
  256. gitBridge: true,
  257. versioning: true,
  258. compileTimeout: 180,
  259. compileGroup: 'standard',
  260. references: true,
  261. templates: true,
  262. trackChanges: true,
  263. }),
  264. features: {
  265. personal: defaultFeatures,
  266. },
  267. groupPlanModalOptions: {
  268. plan_codes: [],
  269. currencies: [],
  270. sizes: [],
  271. usages: [],
  272. },
  273. plans: [
  274. {
  275. planCode: 'personal',
  276. name: 'Personal',
  277. price: 0,
  278. features: defaultFeatures,
  279. },
  280. ],
  281. enableSubscriptions: false,
  282. enabledLinkedFileTypes: (process.env.ENABLED_LINKED_FILE_TYPES || '').split(
  283. ','
  284. ),
  285. // i18n
  286. // ------
  287. //
  288. i18n: {
  289. checkForHTMLInVars: process.env.I18N_CHECK_FOR_HTML_IN_VARS === 'true',
  290. escapeHTMLInVars: process.env.I18N_ESCAPE_HTML_IN_VARS === 'true',
  291. subdomainLang: {
  292. www: { lngCode: 'en', url: siteUrl },
  293. },
  294. defaultLng: 'en',
  295. },
  296. // Spelling languages
  297. // ------------------
  298. //
  299. // You must have the corresponding aspell package installed to
  300. // be able to use a language.
  301. languages: [
  302. { code: 'en', name: 'English' },
  303. { code: 'en_US', name: 'English (American)' },
  304. { code: 'en_GB', name: 'English (British)' },
  305. { code: 'en_CA', name: 'English (Canadian)' },
  306. { code: 'af', name: 'Afrikaans' },
  307. { code: 'ar', name: 'Arabic' },
  308. { code: 'gl', name: 'Galician' },
  309. { code: 'eu', name: 'Basque' },
  310. { code: 'br', name: 'Breton' },
  311. { code: 'bg', name: 'Bulgarian' },
  312. { code: 'ca', name: 'Catalan' },
  313. { code: 'hr', name: 'Croatian' },
  314. { code: 'cs', name: 'Czech' },
  315. { code: 'da', name: 'Danish' },
  316. { code: 'nl', name: 'Dutch' },
  317. { code: 'eo', name: 'Esperanto' },
  318. { code: 'et', name: 'Estonian' },
  319. { code: 'fo', name: 'Faroese' },
  320. { code: 'fr', name: 'French' },
  321. { code: 'de', name: 'German' },
  322. { code: 'el', name: 'Greek' },
  323. { code: 'id', name: 'Indonesian' },
  324. { code: 'ga', name: 'Irish' },
  325. { code: 'it', name: 'Italian' },
  326. { code: 'kk', name: 'Kazakh' },
  327. { code: 'ku', name: 'Kurdish' },
  328. { code: 'lv', name: 'Latvian' },
  329. { code: 'lt', name: 'Lithuanian' },
  330. { code: 'nr', name: 'Ndebele' },
  331. { code: 'ns', name: 'Northern Sotho' },
  332. { code: 'no', name: 'Norwegian' },
  333. { code: 'fa', name: 'Persian' },
  334. { code: 'pl', name: 'Polish' },
  335. { code: 'pt_BR', name: 'Portuguese (Brazilian)' },
  336. { code: 'pt_PT', name: 'Portuguese (European)' },
  337. { code: 'pa', name: 'Punjabi' },
  338. { code: 'ro', name: 'Romanian' },
  339. { code: 'ru', name: 'Russian' },
  340. { code: 'sk', name: 'Slovak' },
  341. { code: 'sl', name: 'Slovenian' },
  342. { code: 'st', name: 'Southern Sotho' },
  343. { code: 'es', name: 'Spanish' },
  344. { code: 'sv', name: 'Swedish' },
  345. { code: 'tl', name: 'Tagalog' },
  346. { code: 'ts', name: 'Tsonga' },
  347. { code: 'tn', name: 'Tswana' },
  348. { code: 'hsb', name: 'Upper Sorbian' },
  349. { code: 'cy', name: 'Welsh' },
  350. { code: 'xh', name: 'Xhosa' },
  351. ],
  352. translatedLanguages: {
  353. cn: '简体中文',
  354. cs: 'Čeština',
  355. da: 'Dansk',
  356. de: 'Deutsch',
  357. en: 'English',
  358. es: 'Español',
  359. fi: 'Suomi',
  360. fr: 'Français',
  361. it: 'Italiano',
  362. ja: '日本語',
  363. ko: '한국어',
  364. nl: 'Nederlands',
  365. no: 'Norsk',
  366. pl: 'Polski',
  367. pt: 'Português',
  368. ro: 'Română',
  369. ru: 'Русский',
  370. sv: 'Svenska',
  371. tr: 'Türkçe',
  372. uk: 'Українська',
  373. 'zh-CN': '简体中文',
  374. },
  375. // Password Settings
  376. // -----------
  377. // These restrict the passwords users can use when registering
  378. // opts are from http://antelle.github.io/passfield
  379. // passwordStrengthOptions:
  380. // pattern: "aA$3"
  381. // length:
  382. // min: 6
  383. // max: 128
  384. // Email support
  385. // -------------
  386. //
  387. // ShareLaTeX uses nodemailer (http://www.nodemailer.com/) to send transactional emails.
  388. // To see the range of transport and options they support, see http://www.nodemailer.com/docs/transports
  389. // email:
  390. // fromAddress: ""
  391. // replyTo: ""
  392. // lifecycle: false
  393. // # Example transport and parameter settings for Amazon SES
  394. // transport: "SES"
  395. // parameters:
  396. // AWSAccessKeyID: ""
  397. // AWSSecretKey: ""
  398. // For legacy reasons, we need to populate this object.
  399. sentry: {},
  400. // Production Settings
  401. // -------------------
  402. debugPugTemplates: process.env.DEBUG_PUG_TEMPLATES === 'true',
  403. precompilePugTemplatesAtBootTime: process.env
  404. .PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME
  405. ? process.env.PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME === 'true'
  406. : process.env.NODE_ENV === 'production',
  407. // Should javascript assets be served minified or not. Note that you will
  408. // need to run `grunt compile:minify` within the web-sharelatex directory
  409. // to generate these.
  410. useMinifiedJs: process.env.MINIFIED_JS === 'true' || false,
  411. // Should static assets be sent with a header to tell the browser to cache
  412. // them.
  413. cacheStaticAssets: false,
  414. // If you are running ShareLaTeX over https, set this to true to send the
  415. // cookie with a secure flag (recommended).
  416. secureCookie: false,
  417. // 'SameSite' cookie setting. Can be set to 'lax', 'none' or 'strict'
  418. // 'lax' is recommended, as 'strict' will prevent people linking to projects
  419. // https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
  420. sameSiteCookie: 'lax',
  421. // If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
  422. // then set this to true to allow it to correctly detect the forwarded IP
  423. // address and http/https protocol information.
  424. behindProxy: false,
  425. // Expose the hostname in the `X-Served-By` response header
  426. exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
  427. // Cookie max age (in milliseconds). Set to false for a browser session.
  428. cookieSessionLength: 5 * 24 * 60 * 60 * 1000, // 5 days
  429. // When true, only allow invites to be sent to email addresses that
  430. // already have user accounts
  431. restrictInvitesToExistingAccounts: false,
  432. // Should we allow access to any page without logging in? This includes
  433. // public projects, /learn, /templates, about pages, etc.
  434. allowPublicAccess: process.env.SHARELATEX_ALLOW_PUBLIC_ACCESS === 'true',
  435. // editor should be open by default
  436. editorIsOpen: process.env.EDITOR_OPEN !== 'false',
  437. // site should be open by default
  438. siteIsOpen: process.env.SITE_OPEN !== 'false',
  439. // Use a single compile directory for all users in a project
  440. // (otherwise each user has their own directory)
  441. // disablePerUserCompiles: true
  442. // Domain the client (pdfjs) should download the compiled pdf from
  443. pdfDownloadDomain: process.env.PDF_DOWNLOAD_DOMAIN, // "http://clsi-lb:3014"
  444. // By default turn on feature flag, can be overridden per request.
  445. enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
  446. // Whether to disable any existing service worker on the next load of the editor
  447. resetServiceWorker: process.env.RESET_SERVICE_WORKER === 'true',
  448. // Maximum size of text documents in the real-time editing system.
  449. max_doc_length: 2 * 1024 * 1024, // 2mb
  450. // Maximum JSON size in HTTP requests
  451. // We should be able to process twice the max doc length, to allow for
  452. // - the doc content
  453. // - text ranges spanning the whole doc
  454. //
  455. // There's also overhead required for the JSON encoding and the UTF-8 encoding,
  456. // theoretically up to 3 times the max doc length. On the other hand, we don't
  457. // want to block the event loop with JSON parsing, so we try to find a
  458. // practical compromise.
  459. max_json_request_size:
  460. parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 6 * 1024 * 1024, // 6 MB
  461. // Internal configs
  462. // ----------------
  463. path: {
  464. // If we ever need to write something to disk (e.g. incoming requests
  465. // that need processing but may be too big for memory, then write
  466. // them to disk here).
  467. dumpFolder: './data/dumpFolder',
  468. uploadFolder: './data/uploads',
  469. },
  470. // Automatic Snapshots
  471. // -------------------
  472. automaticSnapshots: {
  473. // How long should we wait after the user last edited to
  474. // take a snapshot?
  475. waitTimeAfterLastEdit: 5 * minutes,
  476. // Even if edits are still taking place, this is maximum
  477. // time to wait before taking another snapshot.
  478. maxTimeBetweenSnapshots: 30 * minutes,
  479. },
  480. // Smoke test
  481. // ----------
  482. // Provide log in credentials and a project to be able to run
  483. // some basic smoke tests to check the core functionality.
  484. //
  485. smokeTest: {
  486. user: process.env.SMOKE_TEST_USER,
  487. userId: process.env.SMOKE_TEST_USER_ID,
  488. password: process.env.SMOKE_TEST_PASSWORD,
  489. projectId: process.env.SMOKE_TEST_PROJECT_ID,
  490. rateLimitSubject: process.env.SMOKE_TEST_RATE_LIMIT_SUBJECT || '127.0.0.1',
  491. stepTimeout: parseInt(process.env.SMOKE_TEST_STEP_TIMEOUT || '10000', 10),
  492. },
  493. appName: process.env.APP_NAME || 'ShareLaTeX (Community Edition)',
  494. adminEmail: process.env.ADMIN_EMAIL || 'placeholder@example.com',
  495. adminDomains: process.env.ADMIN_DOMAINS
  496. ? JSON.parse(process.env.ADMIN_DOMAINS)
  497. : undefined,
  498. nav: {
  499. title: 'ShareLaTeX Community Edition',
  500. hide_powered_by: process.env.NAV_HIDE_POWERED_BY === 'true',
  501. left_footer: [],
  502. right_footer: [
  503. {
  504. text: "<i class='fa fa-github-square'></i> Fork on Github!",
  505. url: 'https://github.com/overleaf/overleaf',
  506. },
  507. ],
  508. showSubscriptionLink: false,
  509. header_extras: [],
  510. },
  511. // Example:
  512. // header_extras: [{text: "Some Page", url: "http://example.com/some/page", class: "subdued"}]
  513. recaptcha: {
  514. disabled: {
  515. invite: true,
  516. login: true,
  517. passwordReset: true,
  518. register: true,
  519. },
  520. },
  521. customisation: {},
  522. redirects: {
  523. '/templates/index': '/templates/',
  524. },
  525. reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
  526. rateLimit: {
  527. autoCompile: {
  528. everyone: process.env.RATE_LIMIT_AUTO_COMPILE_EVERYONE || 100,
  529. standard: process.env.RATE_LIMIT_AUTO_COMPILE_STANDARD || 25,
  530. },
  531. },
  532. analytics: {
  533. enabled: false,
  534. },
  535. compileBodySizeLimitMb: process.env.COMPILE_BODY_SIZE_LIMIT_MB || 5,
  536. textExtensions: defaultTextExtensions.concat(
  537. parseTextExtensions(process.env.ADDITIONAL_TEXT_EXTENSIONS)
  538. ),
  539. validRootDocExtensions: ['tex', 'Rtex', 'ltx'],
  540. emailConfirmationDisabled:
  541. process.env.EMAIL_CONFIRMATION_DISABLED === 'true' || false,
  542. enabledServices: (process.env.ENABLED_SERVICES || 'web,api')
  543. .split(',')
  544. .map(s => s.trim()),
  545. // module options
  546. // ----------
  547. modules: {
  548. sanitize: {
  549. options: {
  550. allowedTags: [
  551. 'h1',
  552. 'h2',
  553. 'h3',
  554. 'h4',
  555. 'h5',
  556. 'h6',
  557. 'blockquote',
  558. 'p',
  559. 'a',
  560. 'ul',
  561. 'ol',
  562. 'nl',
  563. 'li',
  564. 'b',
  565. 'i',
  566. 'strong',
  567. 'em',
  568. 'strike',
  569. 'code',
  570. 'hr',
  571. 'br',
  572. 'div',
  573. 'table',
  574. 'thead',
  575. 'col',
  576. 'caption',
  577. 'tbody',
  578. 'tr',
  579. 'th',
  580. 'td',
  581. 'tfoot',
  582. 'pre',
  583. 'iframe',
  584. 'img',
  585. 'figure',
  586. 'figcaption',
  587. 'span',
  588. 'source',
  589. 'video',
  590. 'del',
  591. ],
  592. allowedAttributes: {
  593. a: [
  594. 'href',
  595. 'name',
  596. 'target',
  597. 'class',
  598. 'event-tracking',
  599. 'event-tracking-ga',
  600. 'event-tracking-label',
  601. 'event-tracking-trigger',
  602. ],
  603. div: ['class', 'id', 'style'],
  604. h1: ['class', 'id'],
  605. h2: ['class', 'id'],
  606. h3: ['class', 'id'],
  607. h4: ['class', 'id'],
  608. h5: ['class', 'id'],
  609. h6: ['class', 'id'],
  610. col: ['width'],
  611. figure: ['class', 'id', 'style'],
  612. figcaption: ['class', 'id', 'style'],
  613. i: ['aria-hidden', 'aria-label', 'class', 'id'],
  614. iframe: [
  615. 'allowfullscreen',
  616. 'frameborder',
  617. 'height',
  618. 'src',
  619. 'style',
  620. 'width',
  621. ],
  622. img: ['alt', 'class', 'src', 'style'],
  623. source: ['src', 'type'],
  624. span: ['class', 'id', 'style'],
  625. strong: ['style'],
  626. table: ['border', 'class', 'id', 'style'],
  627. td: ['colspan', 'rowspan', 'headers', 'style'],
  628. th: [
  629. 'abbr',
  630. 'headers',
  631. 'colspan',
  632. 'rowspan',
  633. 'scope',
  634. 'sorted',
  635. 'style',
  636. ],
  637. tr: ['class'],
  638. video: ['alt', 'class', 'controls', 'height', 'width'],
  639. },
  640. },
  641. },
  642. },
  643. overleafModuleImports: {
  644. // modules to import (an empty array for each set of modules)
  645. createFileModes: [],
  646. gitBridge: [],
  647. publishModal: [],
  648. tprLinkedFileInfo: [],
  649. tprLinkedFileRefreshError: [],
  650. contactUsModal: [],
  651. },
  652. moduleImportSequence: ['launchpad', 'server-ce-scripts', 'user-activate'],
  653. csp: {
  654. percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
  655. enabled: process.env.CSP_ENABLED === 'true',
  656. reportOnly: process.env.CSP_REPORT_ONLY === 'true',
  657. reportPercentage: parseFloat(process.env.CSP_REPORT_PERCENTAGE) || 0,
  658. reportUri: process.env.CSP_REPORT_URI,
  659. exclude: ['app/views/project/editor', 'app/views/project/list'],
  660. },
  661. unsupportedBrowsers: {
  662. ie: '<=11',
  663. },
  664. }
  665. module.exports.mergeWith = function (overrides) {
  666. return merge(overrides, module.exports)
  667. }