2020-06-24 05:44:38 -04:00
|
|
|
/* eslint-disable camelcase */
|
|
|
|
|
2020-06-23 13:30:48 -04:00
|
|
|
const settings = {
|
2020-06-23 13:30:51 -04:00
|
|
|
redis: {
|
|
|
|
pubsub: {
|
|
|
|
host:
|
2024-04-25 08:56:00 -04:00
|
|
|
process.env.PUBSUB_REDIS_HOST || process.env.REDIS_HOST || '127.0.0.1',
|
2020-06-23 13:30:51 -04:00
|
|
|
port: process.env.PUBSUB_REDIS_PORT || process.env.REDIS_PORT || '6379',
|
|
|
|
password:
|
|
|
|
process.env.PUBSUB_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
|
|
|
|
maxRetriesPerRequest: parseInt(
|
|
|
|
process.env.PUBSUB_REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
process.env.REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
'20'
|
2021-07-13 07:04:45 -04:00
|
|
|
),
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
realtime: {
|
|
|
|
host:
|
|
|
|
process.env.REAL_TIME_REDIS_HOST ||
|
|
|
|
process.env.REDIS_HOST ||
|
2024-04-25 08:56:00 -04:00
|
|
|
'127.0.0.1',
|
2020-06-23 13:30:51 -04:00
|
|
|
port:
|
|
|
|
process.env.REAL_TIME_REDIS_PORT || process.env.REDIS_PORT || '6379',
|
|
|
|
password:
|
|
|
|
process.env.REAL_TIME_REDIS_PASSWORD ||
|
|
|
|
process.env.REDIS_PASSWORD ||
|
|
|
|
'',
|
|
|
|
key_schema: {
|
|
|
|
clientsInProject({ project_id }) {
|
|
|
|
return `clients_in_project:{${project_id}}`
|
|
|
|
},
|
|
|
|
connectedUser({ project_id, client_id }) {
|
|
|
|
return `connected_user:{${project_id}}:${client_id}`
|
2021-07-13 07:04:45 -04:00
|
|
|
},
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
maxRetriesPerRequest: parseInt(
|
|
|
|
process.env.REAL_TIME_REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
process.env.REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
'20'
|
2021-07-13 07:04:45 -04:00
|
|
|
),
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
documentupdater: {
|
|
|
|
host:
|
|
|
|
process.env.DOC_UPDATER_REDIS_HOST ||
|
|
|
|
process.env.REDIS_HOST ||
|
2024-04-25 08:56:00 -04:00
|
|
|
'127.0.0.1',
|
2020-06-23 13:30:51 -04:00
|
|
|
port:
|
|
|
|
process.env.DOC_UPDATER_REDIS_PORT || process.env.REDIS_PORT || '6379',
|
|
|
|
password:
|
|
|
|
process.env.DOC_UPDATER_REDIS_PASSWORD ||
|
|
|
|
process.env.REDIS_PASSWORD ||
|
|
|
|
'',
|
|
|
|
key_schema: {
|
|
|
|
pendingUpdates({ doc_id }) {
|
|
|
|
return `PendingUpdates:{${doc_id}}`
|
2021-07-13 07:04:45 -04:00
|
|
|
},
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
maxRetriesPerRequest: parseInt(
|
|
|
|
process.env.DOC_UPDATER_REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
process.env.REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
'20'
|
2021-07-13 07:04:45 -04:00
|
|
|
),
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
websessions: {
|
2022-08-08 03:55:04 -04:00
|
|
|
host:
|
|
|
|
process.env.SESSIONS_REDIS_HOST ||
|
|
|
|
process.env.REDIS_HOST ||
|
2024-04-25 08:56:00 -04:00
|
|
|
'127.0.0.1',
|
2022-08-08 03:55:04 -04:00
|
|
|
port: process.env.SESSIONS_REDIS_PORT || process.env.REDIS_PORT || '6379',
|
2020-06-23 13:30:51 -04:00
|
|
|
password:
|
2022-08-08 03:55:04 -04:00
|
|
|
process.env.SESSIONS_REDIS_PASSWORD || process.env.REDIS_PASSWORD || '',
|
2020-06-23 13:30:51 -04:00
|
|
|
maxRetriesPerRequest: parseInt(
|
2022-08-08 03:55:04 -04:00
|
|
|
process.env.SESSIONS_REDIS_MAX_RETRIES_PER_REQUEST ||
|
2020-06-23 13:30:51 -04:00
|
|
|
process.env.REDIS_MAX_RETRIES_PER_REQUEST ||
|
|
|
|
'20'
|
2021-07-13 07:04:45 -04:00
|
|
|
),
|
|
|
|
},
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
internal: {
|
|
|
|
realTime: {
|
|
|
|
port: 3026,
|
2024-04-25 08:56:00 -04:00
|
|
|
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
|
2021-07-13 07:04:45 -04:00
|
|
|
},
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
apis: {
|
|
|
|
web: {
|
|
|
|
url: `http://${
|
2024-04-25 08:56:00 -04:00
|
|
|
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
|
2020-06-23 13:30:51 -04:00
|
|
|
}:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
|
2024-02-06 04:34:15 -05:00
|
|
|
user: process.env.WEB_API_USER || 'overleaf',
|
2021-07-13 07:04:45 -04:00
|
|
|
pass: process.env.WEB_API_PASSWORD || 'password',
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
documentupdater: {
|
|
|
|
url: `http://${
|
|
|
|
process.env.DOCUMENT_UPDATER_HOST ||
|
|
|
|
process.env.DOCUPDATER_HOST ||
|
2024-04-25 08:56:00 -04:00
|
|
|
'127.0.0.1'
|
2021-07-13 07:04:45 -04:00
|
|
|
}:3003`,
|
|
|
|
},
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
security: {
|
2024-05-23 10:51:27 -04:00
|
|
|
sessionSecret: process.env.SESSION_SECRET,
|
|
|
|
sessionSecretUpcoming: process.env.SESSION_SECRET_UPCOMING,
|
|
|
|
sessionSecretFallback: process.env.SESSION_SECRET_FALLBACK,
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
2024-02-06 04:34:15 -05:00
|
|
|
cookieName: process.env.COOKIE_NAME || 'overleaf.sid',
|
2020-06-23 13:30:51 -04:00
|
|
|
|
2020-07-06 09:27:46 -04:00
|
|
|
// Expose the hostname in the `debug.getHostname` rpc
|
|
|
|
exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
|
|
|
|
|
2020-06-23 13:30:51 -04:00
|
|
|
max_doc_length: 2 * 1024 * 1024, // 2mb
|
|
|
|
|
2021-02-08 07:19:25 -05:00
|
|
|
// should be set to the same same as dispatcherCount in document updater
|
|
|
|
pendingUpdateListShardCount: parseInt(
|
2021-02-16 05:53:35 -05:00
|
|
|
process.env.PENDING_UPDATE_LIST_SHARD_COUNT || 10,
|
2021-02-08 07:19:25 -05:00
|
|
|
10
|
|
|
|
),
|
|
|
|
|
2020-06-23 13:30:51 -04:00
|
|
|
// combine
|
|
|
|
// max_doc_length (2mb see above) * 2 (delete + insert)
|
|
|
|
// max_ranges_size (3mb see MAX_RANGES_SIZE in document-updater)
|
|
|
|
// overhead for JSON serialization
|
|
|
|
maxUpdateSize:
|
|
|
|
parseInt(process.env.MAX_UPDATE_SIZE) || 7 * 1024 * 1024 + 64 * 1024,
|
|
|
|
|
|
|
|
shutdownDrainTimeWindow: process.env.SHUTDOWN_DRAIN_TIME_WINDOW || 9,
|
|
|
|
|
2020-08-13 07:12:12 -04:00
|
|
|
// The shutdown procedure asks clients to reconnect gracefully.
|
|
|
|
// 3rd-party/buggy clients may not act upon receiving the message and keep
|
|
|
|
// stale connections alive. We forcefully disconnect them after X ms:
|
|
|
|
gracefulReconnectTimeoutMs:
|
|
|
|
parseInt(process.env.GRACEFUL_RECONNECT_TIMEOUT_MS, 10) ||
|
|
|
|
// The frontend allows actively editing users to keep the connection open
|
|
|
|
// for up-to ConnectionManager.MAX_RECONNECT_GRACEFULLY_INTERVAL=45s
|
|
|
|
// Permit an extra delay to account for slow/flaky connections.
|
|
|
|
(45 + 30) * 1000,
|
|
|
|
|
2020-06-23 13:30:51 -04:00
|
|
|
continualPubsubTraffic: process.env.CONTINUAL_PUBSUB_TRAFFIC || false,
|
|
|
|
|
|
|
|
checkEventOrder: process.env.CHECK_EVENT_ORDER || false,
|
|
|
|
|
|
|
|
publishOnIndividualChannels:
|
|
|
|
process.env.PUBLISH_ON_INDIVIDUAL_CHANNELS || false,
|
|
|
|
|
|
|
|
statusCheckInterval: parseInt(process.env.STATUS_CHECK_INTERVAL || '0'),
|
|
|
|
|
2021-03-19 12:27:27 -04:00
|
|
|
// The deployment colour for this app (if any). Used for blue green deploys.
|
|
|
|
deploymentColour: process.env.DEPLOYMENT_COLOUR,
|
|
|
|
// Load balancer health checks will return 200 only when this file contains
|
|
|
|
// the deployment colour for this app.
|
|
|
|
deploymentFile: process.env.DEPLOYMENT_FILE,
|
|
|
|
|
2020-06-23 13:30:51 -04:00
|
|
|
sentry: {
|
2021-07-13 07:04:45 -04:00
|
|
|
dsn: process.env.SENTRY_DSN,
|
2020-06-23 13:30:51 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
catchUncaughtErrors: true,
|
2021-07-13 07:04:45 -04:00
|
|
|
shutdownOnUncaughtError: true,
|
|
|
|
},
|
2021-09-14 04:36:24 -04:00
|
|
|
|
|
|
|
behindProxy: process.env.BEHIND_PROXY === 'true',
|
|
|
|
trustedProxyIps: process.env.TRUSTED_PROXY_IPS,
|
2023-10-23 08:42:55 -04:00
|
|
|
keepAliveTimeoutMs: parseInt(process.env.KEEPALIVE_TIMEOUT_MS ?? '5000', 10),
|
2020-06-23 13:30:51 -04:00
|
|
|
}
|
|
|
|
|
2020-06-23 13:30:48 -04:00
|
|
|
// console.log settings.redis
|
2020-06-23 13:30:51 -04:00
|
|
|
module.exports = settings
|