mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
Migrate from `settings-sharelatex` to `@overleaf/settings` GitOrigin-RevId: 9a298ba26382180c1351683c5fddc9004418c1e6
25 lines
744 B
JavaScript
25 lines
744 B
JavaScript
const Settings = require('@overleaf/settings')
|
|
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)
|
|
},
|
|
}
|