File tree Expand file tree Collapse file tree
libs/accounts/rate-limit/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const RateLimitRedisProvider: Provider = {
1919 throw new Error ( 'Missing config for redis' ) ;
2020 }
2121
22- const redisRateLimitConfig = config . get < RedisOptions > ( 'redis.customs ' ) ;
22+ const redisRateLimitConfig = config . get < RedisOptions > ( 'redis.ratelimit ' ) ;
2323 if ( redisRateLimitConfig == null ) {
2424 throw new Error ( 'Missing config for redis.customs' ) ;
2525 }
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ async function run(config) {
225225 const rules = parseConfigRules ( config . rateLimit . rules ) ;
226226 const rateLimitRedis = new Redis ( {
227227 ...config . redis ,
228- ...config . redis . customs ,
228+ ...config . redis . ratelimit ,
229229 } ) ;
230230 const rateLimit = new RateLimit (
231231 {
Original file line number Diff line number Diff line change @@ -199,33 +199,33 @@ const conf = convict({
199199 doc : 'Key prefix for access tokens in Redis' ,
200200 } ,
201201 } ,
202- customs : {
202+ ratelimit : {
203203 enabled : {
204- default : false ,
204+ default : true ,
205205 doc : 'Enable Redis for customs server rate limiting' ,
206206 format : Boolean ,
207- env : 'CUSTOMS_REDIS_ENABLED ' ,
207+ env : 'RATELIMIT_REDIS_ENABLED ' ,
208208 } ,
209209 host : {
210210 default : 'localhost' ,
211- env : 'CUSTOMS_REDIS_HOST ' ,
211+ env : 'RATELIMIT_REDIS_HOST ' ,
212212 format : String ,
213213 } ,
214214 port : {
215215 default : 6379 ,
216- env : 'CUSTOMS_REDIS_PORT ' ,
216+ env : 'RATELIMIT_REDIS_PORT ' ,
217217 format : 'port' ,
218218 } ,
219219 password : {
220220 default : '' ,
221- env : 'CUSTOMS_REDIS_PASSWORD ' ,
221+ env : 'RATELIMIT_REDIS_PASSWORD ' ,
222222 format : String ,
223223 sensitive : true ,
224224 doc : `Password for connecting to redis` ,
225225 } ,
226226 prefix : {
227- default : 'customs :' ,
228- env : 'CUSTOMS_REDIS_KEY_PREFIX ' ,
227+ default : 'ratelimit :' ,
228+ env : 'RATELIMIT_REDIS_KEY_PREFIX ' ,
229229 format : String ,
230230 doc : 'Key prefix for custom server records in Redis' ,
231231 } ,
Original file line number Diff line number Diff line change @@ -308,6 +308,38 @@ export function makeRedisConfig() {
308308 } ,
309309 } ,
310310
311+ ratelimit : {
312+ enabled : {
313+ default : true ,
314+ doc : 'Enable Redis for customs server rate limiting' ,
315+ format : Boolean ,
316+ env : 'RATELIMIT_REDIS_ENABLED' ,
317+ } ,
318+ host : {
319+ default : 'localhost' ,
320+ env : 'RATELIMIT_REDIS_HOST' ,
321+ format : String ,
322+ } ,
323+ port : {
324+ default : 6379 ,
325+ env : 'RATELIMIT_REDIS_PORT' ,
326+ format : 'port' ,
327+ } ,
328+ password : {
329+ default : '' ,
330+ env : 'RATELIMIT_REDIS_PASSWORD' ,
331+ format : String ,
332+ sensitive : true ,
333+ doc : `Password for connecting to redis` ,
334+ } ,
335+ prefix : {
336+ default : 'ratelimit:' ,
337+ env : 'RATELIMIT_REDIS_KEY_PREFIX' ,
338+ format : String ,
339+ doc : 'Key prefix for custom server records in Redis' ,
340+ } ,
341+ } ,
342+
311343 metrics : {
312344 enabled : {
313345 default : true ,
You can’t perform that action at this time.
0 commit comments