settings.defaults.js 23 KB

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