From 90564eeed2418eac52cef45a575108362c318879 Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Tue, 5 Dec 2023 16:52:15 -0600 Subject: [PATCH] Tweak rate limit cfg (#1931) tweak rate limit cfg --- packages/bsky/src/config.ts | 22 +++++++++++----------- packages/bsky/src/index.ts | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/bsky/src/config.ts b/packages/bsky/src/config.ts index 39556c9577d..c04eef6c63c 100644 --- a/packages/bsky/src/config.ts +++ b/packages/bsky/src/config.ts @@ -37,8 +37,8 @@ export interface ServerConfigValues { triagePassword?: string moderationPushUrl?: string rateLimitsEnabled: boolean - rateLimitsBypassKey?: string - rateLimitsBypassIps?: string[] + rateLimitBypassKey?: string + rateLimitBypassIps?: string[] } export class ServerConfig { @@ -119,9 +119,9 @@ export class ServerConfig { process.env.MODERATION_PUSH_URL || undefined const rateLimitsEnabled = process.env.RATE_LIMITS_ENABLED === 'true' - const rateLimitsBypassKey = process.env.RATE_LIMITS_BYPASS_KEY - const rateLimitsBypassIps = process.env.RATE_LIMITS_BYPASS_IPS - ? process.env.RATE_LIMITS_BYPASS_IPS.split(',') + const rateLimitBypassKey = process.env.RATE_LIMIT_BYPASS_KEY + const rateLimitBypassIps = process.env.RATE_LIMIT_BYPASS_IPS + ? process.env.RATE_LIMIT_BYPASS_IPS.split(',') : undefined return new ServerConfig({ @@ -154,8 +154,8 @@ export class ServerConfig { triagePassword, moderationPushUrl, rateLimitsEnabled, - rateLimitsBypassKey, - rateLimitsBypassIps, + rateLimitBypassKey, + rateLimitBypassIps, ...stripUndefineds(overrides ?? {}), }) } @@ -289,12 +289,12 @@ export class ServerConfig { return this.cfg.rateLimitsEnabled } - get rateLimitsBypassKey() { - return this.cfg.rateLimitsBypassKey + get rateLimitBypassKey() { + return this.cfg.rateLimitBypassKey } - get rateLimitsBypassIps() { - return this.cfg.rateLimitsBypassIps + get rateLimitBypassIps() { + return this.cfg.rateLimitBypassIps } } diff --git a/packages/bsky/src/index.ts b/packages/bsky/src/index.ts index d3fcd20279b..2f83efb3746 100644 --- a/packages/bsky/src/index.ts +++ b/packages/bsky/src/index.ts @@ -153,8 +153,8 @@ export class BskyAppView { if (config.rateLimitsEnabled) { const rlCreator = (opts: RateLimiterOpts) => RateLimiter.redis(redis.driver, { - bypassSecret: config.rateLimitsBypassKey, - bypassIps: config.rateLimitsBypassIps, + bypassSecret: config.rateLimitBypassKey, + bypassIps: config.rateLimitBypassIps, ...opts, }) xrpcOpts['rateLimits'] = {