Provide hosts as environment settings, add npm run start script and update coffeescript

This commit is contained in:
James Allen 2017-12-29 08:13:16 +00:00
parent 85de4f2bc5
commit ccf6cb1a18
3 changed files with 20 additions and 15 deletions

View file

@ -44,7 +44,7 @@ module.exports = RedisManager =
docLines = JSON.stringify(docLines)
if docLines.indexOf("\u0000") != -1
error = new Error("null bytes found in doc lines")
logger.error err: error, doc_id: doc_id, docLines: docLines, error.message
logger.error {err: error, doc_id: doc_id, docLines: docLines}, error.message
return callback(error)
docHash = RedisManager._computeHash(docLines)
logger.log project_id:project_id, doc_id:doc_id, version: version, hash:docHash, "putting doc in redis"
@ -216,13 +216,13 @@ module.exports = RedisManager =
for op in jsonOps
if op.indexOf("\u0000") != -1
error = new Error("null bytes found in jsonOps")
logger.error err: error, doc_id: doc_id, jsonOps: jsonOps, error.message
logger.error {err: error, doc_id: doc_id, jsonOps: jsonOps}, error.message
return callback(error)
newDocLines = JSON.stringify(docLines)
if newDocLines.indexOf("\u0000") != -1
error = new Error("null bytes found in doc lines")
logger.error err: error, doc_id: doc_id, newDocLines: newDocLines, error.message
logger.error {err: error, doc_id: doc_id, newDocLines: newDocLines}, error.message
return callback(error)
newHash = RedisManager._computeHash(newDocLines)

View file

@ -5,23 +5,24 @@ http.globalAgent.maxSockets = 300
module.exports =
internal:
documentupdater:
host: process.env["LISTEN_ADDRESS"] or "localhost"
port: 3003
apis:
web:
url: "http://localhost:3000"
url: "http://#{process.env["WEB_HOST"] or "localhost"}:3000"
user: "sharelatex"
pass: "password"
trackchanges:
url: "http://localhost:3015"
url: "http://#{process.env["TRACK_CHANGES_HOST"] or "localhost"}:3015"
project_history:
enabled: process.env.SHARELATEX_ENABLE_PROJECT_HISTORY == 'true'
url: "http://localhost:3054"
url: "http://#{process.env["PROJECT_HISTORY_HOST"] or "localhost"}:3054"
redis:
realtime:
port:"6379"
host:"localhost"
port: "6379"
host: process.env["REDIS_HOST"] or "localhost"
password:""
key_schema:
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
@ -33,7 +34,7 @@ module.exports =
# pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
documentupdater:
port: "6379"
host: "localhost"
host: process.env["REDIS_HOST"] or "localhost"
password: ""
key_schema:
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
@ -62,8 +63,8 @@ module.exports =
# ranges: ({doc_id}) -> "Ranges:{#{doc_id}}"
# projectState: ({project_id}) -> "ProjectState:{#{project_id}}"
history:
port:"6379"
host:"localhost"
port: "6379"
host: process.env["REDIS_HOST"] or "localhost"
password:""
key_schema:
uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}"
@ -80,8 +81,8 @@ module.exports =
# uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:{#{doc_id}}"
# docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:{#{project_id}}"
lock:
port:"6379"
host:"localhost"
port: "6379"
host: process.env["REDIS_HOST"] or "localhost"
password:""
key_schema:
blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
@ -95,4 +96,4 @@ module.exports =
max_doc_length: 2 * 1024 * 1024 # 2mb
mongo:
url: 'mongodb://127.0.0.1/sharelatex'
url: "mongodb://#{process.env["MONGO_HOST"] or "localhost"}/sharelatex"

View file

@ -6,9 +6,13 @@
"type": "git",
"url": "https://github.com/sharelatex/document-updater-sharelatex.git"
},
"scripts": {
"compile:app": "coffee -o app/js -c app/coffee && coffee -c app.coffee",
"start": "npm run compile:app && node app.js"
},
"dependencies": {
"async": "^2.5.0",
"coffee-script": "1.4.0",
"coffee-script": "~1.7.0",
"express": "3.3.4",
"logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.5.6",
"lynx": "0.0.11",