settings.defaults.js 28 KB

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