settings.coffee 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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. # Spell Check Languages
  115. # ---------------------
  116. #
  117. # You must have the corresponding aspell dictionary installed to
  118. # be able to use a language. Run `grunt check:aspell` to check which
  119. # dictionaries you have installed. These should be set for the `code` for
  120. # each language.
  121. languages: [{
  122. "code":"en",
  123. "name":"English (American)"
  124. },{
  125. "code":"en_GB",
  126. "name":"English (British)"
  127. },{
  128. "code":"af",
  129. "name":"Africaans"
  130. },{
  131. "code":"am",
  132. "name":"Amharic"
  133. },{
  134. "code":"ar",
  135. "name":"Arabic"
  136. },{
  137. "code":"hy",
  138. "name":"Armenian"
  139. },{
  140. "code":"gl",
  141. "name":"Galician"
  142. },{
  143. "code":"eu",
  144. "name":"Basque"
  145. },{
  146. "code":"bn",
  147. "name":"Bengali"
  148. },{
  149. "code":"br",
  150. "name":"Breton"
  151. },{
  152. "code":"bg",
  153. "name":"Bulgarian"
  154. },{
  155. "code":"ca",
  156. "name":"Catalan"
  157. },{
  158. "code":"hr",
  159. "name":"Croatian"
  160. },{
  161. "code":"cs",
  162. "name":"Czech"
  163. },{
  164. "code":"da",
  165. "name":"Danish"
  166. },{
  167. "code":"nl",
  168. "name":"Dutch"
  169. },{
  170. "code":"eo",
  171. "name":"Esperanto"
  172. },{
  173. "code":"et",
  174. "name":"Estonian"
  175. },{
  176. "code":"fo",
  177. "name":"Faroese"
  178. },{
  179. "code":"fr",
  180. "name":"French"
  181. },{
  182. "code":"de",
  183. "name":"German"
  184. },{
  185. "code":"el",
  186. "name":"Greek"
  187. },{
  188. "code":"gu",
  189. "name":"Gujarati"
  190. },{
  191. "code":"he",
  192. "name":"Hebrew"
  193. },{
  194. "code":"hi",
  195. "name":"Hindi"
  196. },{
  197. "code":"hu",
  198. "name":"Hungarian"
  199. },{
  200. "code":"is",
  201. "name":"Icelandic"
  202. },{
  203. "code":"id",
  204. "name":"Indonesian"
  205. },{
  206. "code":"ga",
  207. "name":"Irish"
  208. },{
  209. "code":"it",
  210. "name":"Italian"
  211. },{
  212. "code":"kn",
  213. "name":"Kannada"
  214. },{
  215. "code":"kk",
  216. "name":"Kazakh"
  217. },{
  218. "code":"ku",
  219. "name":"Kurdish"
  220. },{
  221. "code":"lv",
  222. "name":"Latvian"
  223. },{
  224. "code":"lt",
  225. "name":"Lithuanian"
  226. },{
  227. "code":"ml",
  228. "name":"Malayalam"
  229. },{
  230. "code":"mr",
  231. "name":"Marathi"
  232. },{
  233. "code":"nr",
  234. "name":"Ndebele"
  235. },{
  236. "code":"ns",
  237. "name":"Northern Sotho"
  238. },{
  239. "code":"no",
  240. "name":"Norwegian"
  241. },{
  242. "code":"or",
  243. "name":"Oriya"
  244. },{
  245. "code":"fa",
  246. "name":"Persian"
  247. },{
  248. "code":"pl",
  249. "name":"Polish"
  250. },{
  251. "code":"pt_BR",
  252. "name":"Portuguese (Brazilian)"
  253. },{
  254. "code":"pt_PT",
  255. "name":"Portuguese (European)"
  256. },{
  257. "code":"pa",
  258. "name":"Punjabi"
  259. },{
  260. "code":"ro",
  261. "name":"Romanian"
  262. },{
  263. "code":"ru",
  264. "name":"Russian"
  265. },{
  266. "code":"sk",
  267. "name":"Slovak"
  268. },{
  269. "code":"sl",
  270. "name":"Slovenian"
  271. },{
  272. "code":"st",
  273. "name":"Southern Sotho"
  274. },{
  275. "code":"es",
  276. "name":"Spanish"
  277. },{
  278. "code":"ss",
  279. "name":"Swazi"
  280. },{
  281. "code":"sv",
  282. "name":"Swedish"
  283. },{
  284. "code":"tl",
  285. "name":"Tagalog"
  286. },{
  287. "code":"ta",
  288. "name":"Tamil"
  289. },{
  290. "code":"te",
  291. "name":"Telugu"
  292. },{
  293. "code":"ts",
  294. "name":"Tsonga"
  295. },{
  296. "code":"tn",
  297. "name":"Tswana"
  298. },{
  299. "code":"uk",
  300. "name":"Ukrainian"
  301. },{
  302. "code":"hsb",
  303. "name":"Upper Sorbian"
  304. },{
  305. "code":"uz",
  306. "name":"Uzbek"
  307. },{
  308. "code":"cy",
  309. "name":"Welsh"
  310. },{
  311. "code":"xh",
  312. "name":"Xhosa"
  313. },{
  314. "code":"zu",
  315. "name":"Zulu"
  316. }
  317. ]
  318. # Service locations
  319. # -----------------
  320. # ShareLaTeX is comprised of many small services, which each expose
  321. # an HTTP API running on a different port. Generally you
  322. # can leave these as they are unless you have some other services
  323. # running which conflict, or want to run the web process on port 80.
  324. # internal:
  325. # web:
  326. # port: webPort = 3000
  327. # host: "localhost"
  328. # documentupdater:
  329. # port: docUpdaterPort = 3003
  330. # host: "localhost"
  331. # filestore:
  332. # port: filestorePort = 3009
  333. # host: "localhost"
  334. # chat:
  335. # port: chatPort = 3010
  336. # host: "localhost"
  337. # tags:
  338. # port: tagsPort = 3012
  339. # host: "localhost"
  340. # clsi:
  341. # port: clsiPort = 3013
  342. # host: "localhost"
  343. # trackchanges:
  344. # port: trackchangesPort = 3015
  345. # host: "localhost"
  346. # docstore:
  347. # port: docstorePort = 3016
  348. # host: "localhost"
  349. # spelling:
  350. # port: spellingPort = 3005
  351. # host: "localhost"
  352. # templates:
  353. # port: templatesPort = 3007
  354. # host: "localhost"
  355. # If you change the above config, or run some services on remote servers,
  356. # you need to tell the other services where to find them:
  357. apis:
  358. web:
  359. url: "http://localhost:3000"
  360. user: httpAuthUser
  361. pass: httpAuthPass
  362. # documentupdater:
  363. # url : "http://localhost:#{docUpdaterPort}"
  364. # clsi:
  365. # url: "http://localhost:#{clsiPort}"
  366. # filestore:
  367. # url: "http://localhost:#{filestorePort}"
  368. # trackchanges:
  369. # url: "http://localhost:#{trackchangesPort}"
  370. # docstore:
  371. # url: "http://localhost:#{docstorePort}"
  372. # tags:
  373. # url: "http://localhost:#{tagsPort}"
  374. # spelling:
  375. # url: "http://localhost:#{spellingPort}"
  376. # chat:
  377. # url: "http://localhost:#{chatPort}"
  378. # templates:
  379. # url: "http://localhost:#{templatesPort}"
  380. #### OPTIONAL CONFIGERABLE SETTINGS
  381. # Sending Email
  382. # -------------
  383. #
  384. # You must configure a mail server to be able to send invite emails from
  385. # ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer
  386. # documentation for available options:
  387. #
  388. # http://www.nodemailer.com/docs/transports
  389. if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]
  390. settings.email:
  391. fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]
  392. replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or ""
  393. parameters:
  394. #AWS Creds
  395. AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"]
  396. AWSSecretKey: process.env["SHARELATEX_EMAIL_AWS_SES_SECRET_KEY"]
  397. #SMTP Creds
  398. host: process.env["SHARELATEX_EMAIL_SMTP_HOST"]
  399. port: process.env["SHARELATEX_EMAIL_SMTP_PORT"],
  400. secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"]
  401. auth:
  402. user: process.env["SHARELATEX_EMAIL_SMTP_USER"]
  403. pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"]
  404. # Password Settings
  405. # -----------
  406. # These restrict the passwords users can use when registering
  407. # opts are from http://antelle.github.io/passfield
  408. if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"]
  409. settings.passwordStrengthOptions:
  410. pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3"
  411. length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50}
  412. #######################
  413. # ShareLaTeX Server Pro
  414. #######################
  415. # LDAP - SERVER PRO ONLY
  416. # ----------
  417. # Settings below use a working LDAP test server kindly provided by forumsys.com
  418. # When testing with forumsys.com use username = einstein and password = password
  419. if process.env["SHARELATEX_LDAP_HOST"]
  420. settings.ldap :
  421. host: process.env["SHARELATEX_LDAP_HOST"]
  422. dn: process.env["SHARELATEX_LDAP_DN"]
  423. baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"]
  424. filter: process.env["SHARELATEX_LDAP_FILTER"]
  425. failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail'
  426. fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User'
  427. placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID'
  428. emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail'
  429. anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] or false
  430. adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"]
  431. adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"]
  432. starttls: process.env["SHARELATEX_LDAP_TLS"] or false
  433. tlsOptions:
  434. rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] or false
  435. ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem'
  436. # Compiler
  437. # --------
  438. if process.env["DOCKER_IN_DOCKER"]
  439. clsi:
  440. commandRunner: "docker-runner-sharelatex"
  441. docker:
  442. image: "sharelatex-texlive"
  443. env:
  444. 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"
  445. user: "tex"
  446. # Templates
  447. # ---------
  448. if process.env["SHARELATEX_TEMPLATES_USER_ID"]
  449. templates:
  450. mountPointUrl: "/templates"
  451. user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"]
  452. # With lots of incoming and outgoing HTTP connections to different services,
  453. # sometimes long running, it is a good idea to increase the default number
  454. # of sockets that Node will hold open.
  455. http = require('http')
  456. http.globalAgent.maxSockets = 300
  457. https = require('https')
  458. https.globalAgent.maxSockets = 300
  459. module.exports = settings