Merge pull request #167 from overleaf/jpa-expose-hostname

[misc] reland optionally expose the hostname in the 'debug.getHostname' rpc
This commit is contained in:
Jakob Ackermann 2020-07-07 12:10:58 +02:00 committed by GitHub
commit 383f7a1e2e
2 changed files with 18 additions and 0 deletions

View file

@ -21,6 +21,8 @@ const httpAuth = basicAuth(function (user, pass) {
return isValid
})
const HOSTNAME = require('os').hostname()
let Router
module.exports = Router = {
_handleError(callback, error, client, method, attrs) {
@ -157,6 +159,19 @@ module.exports = Router = {
user = { _id: 'anonymous-user' }
}
if (settings.exposeHostname) {
client.on('debug.getHostname', function (callback) {
if (typeof callback !== 'function') {
return Router._handleInvalidArguments(
client,
'debug.getHostname',
arguments
)
}
callback(HOSTNAME)
})
}
client.on('joinProject', function (data, callback) {
data = data || {}
if (typeof callback !== 'function') {

View file

@ -109,6 +109,9 @@ const settings = {
cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
// Expose the hostname in the `debug.getHostname` rpc
exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
max_doc_length: 2 * 1024 * 1024, // 2mb
// combine