Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/accounts/rate-limit/src/lib/rate-limit.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const RateLimitRedisProvider: Provider = {
throw new Error('Missing config for redis');
}

const redisRateLimitConfig = config.get<RedisOptions>('redis.customs');
const redisRateLimitConfig = config.get<RedisOptions>('redis.ratelimit');
if (redisRateLimitConfig == null) {
throw new Error('Missing config for redis.customs');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-auth-server/bin/key_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async function run(config) {
const rules = parseConfigRules(config.rateLimit.rules);
const rateLimitRedis = new Redis({
...config.redis,
...config.redis.customs,
...config.redis.ratelimit,
});
const rateLimit = new RateLimit(
{
Expand Down
16 changes: 8 additions & 8 deletions packages/fxa-graphql-api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,33 +199,33 @@ const conf = convict({
doc: 'Key prefix for access tokens in Redis',
},
},
customs: {
ratelimit: {
enabled: {
default: false,
default: true,
doc: 'Enable Redis for customs server rate limiting',
format: Boolean,
env: 'CUSTOMS_REDIS_ENABLED',
env: 'RATELIMIT_REDIS_ENABLED',
},
host: {
default: 'localhost',
env: 'CUSTOMS_REDIS_HOST',
env: 'RATELIMIT_REDIS_HOST',
format: String,
},
port: {
default: 6379,
env: 'CUSTOMS_REDIS_PORT',
env: 'RATELIMIT_REDIS_PORT',
format: 'port',
},
password: {
default: '',
env: 'CUSTOMS_REDIS_PASSWORD',
env: 'RATELIMIT_REDIS_PASSWORD',
format: String,
sensitive: true,
doc: `Password for connecting to redis`,
},
prefix: {
default: 'customs:',
env: 'CUSTOMS_REDIS_KEY_PREFIX',
default: 'ratelimit:',
env: 'RATELIMIT_REDIS_KEY_PREFIX',
format: String,
doc: 'Key prefix for custom server records in Redis',
},
Expand Down
32 changes: 32 additions & 0 deletions packages/fxa-shared/db/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,38 @@ export function makeRedisConfig() {
},
},

ratelimit: {
enabled: {
default: true,
doc: 'Enable Redis for customs server rate limiting',
format: Boolean,
env: 'RATELIMIT_REDIS_ENABLED',
},
host: {
default: 'localhost',
env: 'RATELIMIT_REDIS_HOST',
format: String,
},
port: {
default: 6379,
env: 'RATELIMIT_REDIS_PORT',
format: 'port',
},
password: {
default: '',
env: 'RATELIMIT_REDIS_PASSWORD',
format: String,
sensitive: true,
doc: `Password for connecting to redis`,
},
prefix: {
default: 'ratelimit:',
env: 'RATELIMIT_REDIS_KEY_PREFIX',
format: String,
doc: 'Key prefix for custom server records in Redis',
},
},

metrics: {
enabled: {
default: true,
Expand Down