mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-23 02:55:13 -04:00
8bf8fe7dcd
[misc] bump @overleaf/redis-wrapper to version 2.0.0 GitOrigin-RevId: 5d245cc3fd92633d79a0eb8f8227fe74e1b378e7
24 lines
744 B
JavaScript
24 lines
744 B
JavaScript
const Settings = require('settings-sharelatex')
|
|
const redis = require('@overleaf/redis-wrapper')
|
|
|
|
if (
|
|
typeof global.beforeEach === 'function' &&
|
|
process.argv.join(' ').match(/unit/)
|
|
) {
|
|
throw new Error(
|
|
'It looks like unit tests are running, but you are connecting to Redis. Missing a stub?'
|
|
)
|
|
}
|
|
|
|
// A per-feature interface to Redis,
|
|
// looks up the feature in `settings.redis`
|
|
// and returns an appropriate client.
|
|
// Necessary because we don't want to migrate web over
|
|
// to redis-cluster all at once.
|
|
module.exports = {
|
|
// feature = 'websessions' | 'ratelimiter' | ...
|
|
client(feature) {
|
|
const redisFeatureSettings = Settings.redis[feature] || Settings.redis.web
|
|
return redis.createClient(redisFeatureSettings)
|
|
}
|
|
}
|