settings.coffee 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. Path = require('path')
  2. # These credentials are used for authenticating api requests
  3. # between services that may need to go over public channels
  4. httpAuthUser = "sharelatex"
  5. httpAuthPass = "CRYPTO_RANDOM" # Randomly generated for you
  6. httpAuthUsers = {}
  7. httpAuthUsers[httpAuthUser] = httpAuthPass
  8. DATA_DIR = '/var/lib/sharelatex/data'
  9. TMP_DIR = '/var/lib/sharelatex/tmp'
  10. settings =
  11. # Databases
  12. # ---------
  13. # ShareLaTeX's main persistant data store is MongoDB (http://www.mongodb.org/)
  14. # Documentation about the URL connection string format can be found at:
  15. #
  16. # http://docs.mongodb.org/manual/reference/connection-string/
  17. #
  18. # The following works out of the box with Mongo's default settings:
  19. mongo:
  20. url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://dockerhost/sharelatex'
  21. # Redis is used in ShareLaTeX for high volume queries, like real-time
  22. # editing, and session management.
  23. #
  24. # The following config will work with Redis's default settings:
  25. redis:
  26. web: redisConfig =
  27. host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost"
  28. port: process.env["SHARELATEX_REDIS_PORT"] or "6379"
  29. password: process.env["SHARELATEX_REDIS_PASS"] or ""
  30. fairy: redisConfig
  31. # The compile server (the clsi) uses a SQL database to cache files and
  32. # meta-data. sqllite is the default, and the load is low enough that this will
  33. # be fine in production (we use sqllite at sharelatex.com).
  34. #
  35. # If you want to configure a different database, see the Sequelize documentation
  36. # for available options:
  37. #
  38. # https://github.com/sequelize/sequelize/wiki/API-Reference-Sequelize#example-usage
  39. #
  40. mysql:
  41. clsi:
  42. database: "clsi"
  43. username: "clsi"
  44. password: ""
  45. dialect: "sqlite"
  46. storage: Path.join(DATA_DIR, "db.sqlite")
  47. # File storage
  48. # ------------
  49. # ShareLaTeX can store binary files like images either locally or in Amazon
  50. # S3. The default is locally:
  51. filestore:
  52. backend: "fs"
  53. stores:
  54. user_files: Path.join(DATA_DIR, "user_files")
  55. template_files: Path.join(DATA_DIR, "template_files")
  56. # To use Amazon S3 as a storage backend, comment out the above config, and
  57. # uncomment the following, filling in your key, secret, and bucket name:
  58. #
  59. # filestore:
  60. # backend: "s3"
  61. # stores:
  62. # user_files: "BUCKET_NAME"
  63. # s3:
  64. # key: "AWS_KEY"
  65. # secret: "AWS_SECRET"
  66. #
  67. # Local disk caching
  68. # ------------------
  69. path:
  70. # If we ever need to write something to disk (e.g. incoming requests
  71. # that need processing but may be too big for memory), then write
  72. # them to disk here:
  73. dumpFolder: Path.join(TMP_DIR, "dumpFolder")
  74. # Where to write uploads before they are processed
  75. uploadFolder: Path.join(TMP_DIR, "uploads")
  76. # Where to write the project to disk before running LaTeX on it
  77. compilesDir: Path.join(DATA_DIR, "compiles")
  78. # Where to cache downloaded URLs for the CLSI
  79. clsiCacheDir: Path.join(DATA_DIR, "cache")
  80. # Server Config
  81. # -------------
  82. # Where your instance of ShareLaTeX can be found publicly. This is used
  83. # when emails are sent out and in generated links:
  84. siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost'
  85. # The name this is used to describe your ShareLaTeX Installation
  86. appName: process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX (Community Edition)"
  87. nav:
  88. title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Comunity Edition"
  89. # The email address which users will be directed to as the main point of
  90. # contact for this installation of ShareLaTeX.
  91. adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] or "placeholder@example.com"
  92. # If provided, a sessionSecret is used to sign cookies so that they cannot be
  93. # spoofed. This is recommended.
  94. security:
  95. sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or "CRYPTO_RANDOM" # This was randomly generated for you
  96. # These credentials are used for authenticating api requests
  97. # between services that may need to go over public channels
  98. httpAuthUsers: httpAuthUsers
  99. # Should javascript assets be served minified or not. Note that you will
  100. # need to run `grunt compile:minify` within the web-sharelatex directory
  101. # to generate these.
  102. useMinifiedJs: true
  103. # Should static assets be sent with a header to tell the browser to cache
  104. # them. This should be false in development where changes are being made,
  105. # but should be set to true in production.
  106. cacheStaticAssets: true
  107. # If you are running ShareLaTeX over https, set this to true to send the
  108. # cookie with a secure flag (recommended).
  109. secureCookie: process.env["SHARELATEX_SECURE_COOKIE"]?
  110. # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
  111. # then set this to true to allow it to correctly detect the forwarded IP
  112. # address and http/https protocol information.
  113. behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false
  114. if process.env["SHARELATEX_LEFT_FOOTER"]
  115. left_footer: process.env["SHARELATEX_LEFT_FOOTER"]
  116. if process.env["SHARELATEX_RIGHT_FOOTER"]
  117. right_footer: process.env["SHARELATEX_RIGHT_FOOTER"]
  118. if process.env["SHARELATEX_HEADER"]
  119. header: process.env["SHARELATEX_HEADER"]
  120. # Spell Check Languages
  121. # ---------------------
  122. #
  123. # You must have the corresponding aspell dictionary installed to
  124. # be able to use a language. Run `grunt check:aspell` to check which
  125. # dictionaries you have installed. These should be set for the `code` for
  126. # each language.
  127. languages: [{
  128. "code":"en",
  129. "name":"English (American)"
  130. },{
  131. "code":"en_GB",
  132. "name":"English (British)"
  133. },{
  134. "code":"af",
  135. "name":"Africaans"
  136. },{
  137. "code":"am",
  138. "name":"Amharic"
  139. },{
  140. "code":"ar",
  141. "name":"Arabic"
  142. },{
  143. "code":"hy",
  144. "name":"Armenian"
  145. },{
  146. "code":"gl",
  147. "name":"Galician"
  148. },{
  149. "code":"eu",
  150. "name":"Basque"
  151. },{
  152. "code":"bn",
  153. "name":"Bengali"
  154. },{
  155. "code":"br",
  156. "name":"Breton"
  157. },{
  158. "code":"bg",
  159. "name":"Bulgarian"
  160. },{
  161. "code":"ca",
  162. "name":"Catalan"
  163. },{
  164. "code":"hr",
  165. "name":"Croatian"
  166. },{
  167. "code":"cs",
  168. "name":"Czech"
  169. },{
  170. "code":"da",
  171. "name":"Danish"
  172. },{
  173. "code":"nl",
  174. "name":"Dutch"
  175. },{
  176. "code":"eo",
  177. "name":"Esperanto"
  178. },{
  179. "code":"et",
  180. "name":"Estonian"
  181. },{
  182. "code":"fo",
  183. "name":"Faroese"
  184. },{
  185. "code":"fr",
  186. "name":"French"
  187. },{
  188. "code":"de",
  189. "name":"German"
  190. },{
  191. "code":"el",
  192. "name":"Greek"
  193. },{
  194. "code":"gu",
  195. "name":"Gujarati"
  196. },{
  197. "code":"he",
  198. "name":"Hebrew"
  199. },{
  200. "code":"hi",
  201. "name":"Hindi"
  202. },{
  203. "code":"hu",
  204. "name":"Hungarian"
  205. },{
  206. "code":"is",
  207. "name":"Icelandic"
  208. },{
  209. "code":"id",
  210. "name":"Indonesian"
  211. },{
  212. "code":"ga",
  213. "name":"Irish"
  214. },{
  215. "code":"it",
  216. "name":"Italian"
  217. },{
  218. "code":"kn",
  219. "name":"Kannada"
  220. },{
  221. "code":"kk",
  222. "name":"Kazakh"
  223. },{
  224. "code":"ku",
  225. "name":"Kurdish"
  226. },{
  227. "code":"lv",
  228. "name":"Latvian"
  229. },{
  230. "code":"lt",
  231. "name":"Lithuanian"
  232. },{
  233. "code":"ml",
  234. "name":"Malayalam"
  235. },{
  236. "code":"mr",
  237. "name":"Marathi"
  238. },{
  239. "code":"nr",
  240. "name":"Ndebele"
  241. },{
  242. "code":"ns",
  243. "name":"Northern Sotho"
  244. },{
  245. "code":"no",
  246. "name":"Norwegian"
  247. },{
  248. "code":"or",
  249. "name":"Oriya"
  250. },{
  251. "code":"fa",
  252. "name":"Persian"
  253. },{
  254. "code":"pl",
  255. "name":"Polish"
  256. },{
  257. "code":"pt_BR",
  258. "name":"Portuguese (Brazilian)"
  259. },{
  260. "code":"pt_PT",
  261. "name":"Portuguese (European)"
  262. },{
  263. "code":"pa",
  264. "name":"Punjabi"
  265. },{
  266. "code":"ro",
  267. "name":"Romanian"
  268. },{
  269. "code":"ru",
  270. "name":"Russian"
  271. },{
  272. "code":"sk",
  273. "name":"Slovak"
  274. },{
  275. "code":"sl",
  276. "name":"Slovenian"
  277. },{
  278. "code":"st",
  279. "name":"Southern Sotho"
  280. },{
  281. "code":"es",
  282. "name":"Spanish"
  283. },{
  284. "code":"ss",
  285. "name":"Swazi"
  286. },{
  287. "code":"sv",
  288. "name":"Swedish"
  289. },{
  290. "code":"tl",
  291. "name":"Tagalog"
  292. },{
  293. "code":"ta",
  294. "name":"Tamil"
  295. },{
  296. "code":"te",
  297. "name":"Telugu"
  298. },{
  299. "code":"ts",
  300. "name":"Tsonga"
  301. },{
  302. "code":"tn",
  303. "name":"Tswana"
  304. },{
  305. "code":"uk",
  306. "name":"Ukrainian"
  307. },{
  308. "code":"hsb",
  309. "name":"Upper Sorbian"
  310. },{
  311. "code":"uz",
  312. "name":"Uzbek"
  313. },{
  314. "code":"cy",
  315. "name":"Welsh"
  316. },{
  317. "code":"xh",
  318. "name":"Xhosa"
  319. },{
  320. "code":"zu",
  321. "name":"Zulu"
  322. }
  323. ]
  324. # Service locations
  325. # -----------------
  326. # ShareLaTeX is comprised of many small services, which each expose
  327. # an HTTP API running on a different port. Generally you
  328. # can leave these as they are unless you have some other services
  329. # running which conflict, or want to run the web process on port 80.
  330. # internal:
  331. # web:
  332. # port: webPort = 3000
  333. # host: "localhost"
  334. # documentupdater:
  335. # port: docUpdaterPort = 3003
  336. # host: "localhost"
  337. # filestore:
  338. # port: filestorePort = 3009
  339. # host: "localhost"
  340. # chat:
  341. # port: chatPort = 3010
  342. # host: "localhost"
  343. # tags:
  344. # port: tagsPort = 3012
  345. # host: "localhost"
  346. # clsi:
  347. # port: clsiPort = 3013
  348. # host: "localhost"
  349. # trackchanges:
  350. # port: trackchangesPort = 3015
  351. # host: "localhost"
  352. # docstore:
  353. # port: docstorePort = 3016
  354. # host: "localhost"
  355. # spelling:
  356. # port: spellingPort = 3005
  357. # host: "localhost"
  358. # templates:
  359. # port: templatesPort = 3007
  360. # host: "localhost"
  361. # If you change the above config, or run some services on remote servers,
  362. # you need to tell the other services where to find them:
  363. apis:
  364. web:
  365. url: "http://localhost:3000"
  366. user: httpAuthUser
  367. pass: httpAuthPass
  368. # documentupdater:
  369. # url : "http://localhost:#{docUpdaterPort}"
  370. # clsi:
  371. # url: "http://localhost:#{clsiPort}"
  372. # filestore:
  373. # url: "http://localhost:#{filestorePort}"
  374. # trackchanges:
  375. # url: "http://localhost:#{trackchangesPort}"
  376. # docstore:
  377. # url: "http://localhost:#{docstorePort}"
  378. # tags:
  379. # url: "http://localhost:#{tagsPort}"
  380. # spelling:
  381. # url: "http://localhost:#{spellingPort}"
  382. # chat:
  383. # url: "http://localhost:#{chatPort}"
  384. # templates:
  385. # url: "http://localhost:#{templatesPort}"
  386. #### OPTIONAL CONFIGERABLE SETTINGS
  387. # Sending Email
  388. # -------------
  389. #
  390. # You must configure a mail server to be able to send invite emails from
  391. # ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer
  392. # documentation for available options:
  393. #
  394. # http://www.nodemailer.com/docs/transports
  395. if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]
  396. settings.email =
  397. fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]
  398. replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or ""
  399. parameters:
  400. #AWS Creds
  401. AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"]
  402. AWSSecretKey: process.env["SHARELATEX_EMAIL_AWS_SES_SECRET_KEY"]
  403. #SMTP Creds
  404. host: process.env["SHARELATEX_EMAIL_SMTP_HOST"]
  405. port: process.env["SHARELATEX_EMAIL_SMTP_PORT"],
  406. secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"]
  407. auth:
  408. user: process.env["SHARELATEX_EMAIL_SMTP_USER"]
  409. pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"]
  410. # Password Settings
  411. # -----------
  412. # These restrict the passwords users can use when registering
  413. # opts are from http://antelle.github.io/passfield
  414. if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"]
  415. settings.passwordStrengthOptions =
  416. pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3"
  417. length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50}
  418. #######################
  419. # ShareLaTeX Server Pro
  420. #######################
  421. # LDAP - SERVER PRO ONLY
  422. # ----------
  423. # Settings below use a working LDAP test server kindly provided by forumsys.com
  424. # When testing with forumsys.com use username = einstein and password = password
  425. if process.env["SHARELATEX_LDAP_HOST"]
  426. settings.ldap =
  427. host: process.env["SHARELATEX_LDAP_HOST"]
  428. dn: process.env["SHARELATEX_LDAP_DN"]
  429. baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"]
  430. filter: process.env["SHARELATEX_LDAP_FILTER"]
  431. failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail'
  432. fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User'
  433. placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID'
  434. emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail'
  435. anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] == "true"
  436. adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"]
  437. adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"]
  438. starttls: process.env["SHARELATEX_LDAP_TLS"] == "true"
  439. nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"]
  440. lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"]
  441. if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]
  442. settings.ldap.tlsOptions =
  443. rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true"
  444. ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem'
  445. # Compiler
  446. # --------
  447. if process.env["SANDBOXED_COMPILES"] == "true"
  448. settings.clsi =
  449. commandRunner: "docker-runner-sharelatex"
  450. docker:
  451. image: process.env["TEX_LIVE_DOCKER_IMAGE"]
  452. env:
  453. PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  454. user: "www-data"
  455. if !settings.path?
  456. settings.path = {}
  457. settings.path.synctexBaseDir = () -> "/compile"
  458. # Templates
  459. # ---------
  460. if process.env["SHARELATEX_TEMPLATES_USER_ID"]
  461. settings.templates =
  462. mountPointUrl: "/templates"
  463. user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"]
  464. # With lots of incoming and outgoing HTTP connections to different services,
  465. # sometimes long running, it is a good idea to increase the default number
  466. # of sockets that Node will hold open.
  467. http = require('http')
  468. http.globalAgent.maxSockets = 300
  469. https = require('https')
  470. https.globalAgent.maxSockets = 300
  471. module.exports = settings