settings.defaults.js 28 KB

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