зеркало из https://github.com/github/docs.git
Conditionally disable the TLS unauthorized cert check based on REDIS_URL (#17978)
* Conditionally disable the TLS unauthorized cert check based on REDIS_URL * Update middleware/rate-limit.js
This commit is contained in:
Родитель
63cf0c8b44
Коммит
e94b52d7b5
|
@ -26,9 +26,14 @@ class RedisAccessor {
|
|||
? new Redis(REDIS_URL, {
|
||||
...redisBaseOptions,
|
||||
db: databaseNumber,
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
|
||||
// Only add this configuration for TLS-enabled REDIS_URL values.
|
||||
// Otherwise, it breaks for local Redis instances without TLS enabled.
|
||||
...REDIS_URL.startsWith('rediss://') && {
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
}
|
||||
})
|
||||
: new InMemoryRedis()
|
||||
|
|
|
@ -19,9 +19,14 @@ module.exports = rateLimit({
|
|||
store: REDIS_URL && new RedisStore({
|
||||
client: new Redis(REDIS_URL, {
|
||||
db: rateLimitDatabaseNumber,
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
|
||||
// Only add this configuration for TLS-enabled REDIS_URL values.
|
||||
// Otherwise, it breaks for local Redis instances without TLS enabled.
|
||||
...REDIS_URL.startsWith('rediss://') && {
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
}
|
||||
}),
|
||||
// 1 minute (or practically unlimited outside of production)
|
||||
|
|
|
@ -44,9 +44,14 @@ purgeRenderedPageCache()
|
|||
function purgeRenderedPageCache () {
|
||||
const redisClient = new Redis(REDIS_URL, {
|
||||
db: pageCacheDatabaseNumber,
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
|
||||
// Only add this configuration for TLS-enabled REDIS_URL values.
|
||||
// Otherwise, it breaks for local Redis instances without TLS enabled.
|
||||
...REDIS_URL.startsWith('rediss://') && {
|
||||
tls: {
|
||||
// Required for production Heroku Redis
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
}
|
||||
})
|
||||
let totalKeyCount = 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче