mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 15:20:48 +00:00
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:
commit
383f7a1e2e
2 changed files with 18 additions and 0 deletions
|
@ -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') {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue