settings.defaults.js 22 KB

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