Skip to content

Commit

Permalink
Adding _MILLIS suffix to rate limiter env vars (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecamellini authored Oct 10, 2024
1 parent f971cac commit f29fe76
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/api-gateway/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ AWS_CONFIG_FILE=aws.config.local

RATE_LIMITER_BURST_PERCENTAGE="1.0"
RATE_LIMITER_MAX_REQUESTS="10"
RATE_LIMITER_RATE_INTERVAL="1000"
RATE_LIMITER_RATE_INTERVAL_MILLIS="1000"
RATE_LIMITER_REDIS_HOST="localhost"
RATE_LIMITER_REDIS_PORT="6379"
RATE_LIMITER_TIMEOUT="300"
RATE_LIMITER_TIMEOUT_MILLIS="300"

CATALOG_PROCESS_URL="http://localhost:3000"
AGREEMENT_PROCESS_URL="http://localhost:3100"
Expand Down
4 changes: 2 additions & 2 deletions packages/backend-for-frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ SELFCARE_V2_API_KEY=key

RATE_LIMITER_BURST_PERCENTAGE="1.0"
RATE_LIMITER_MAX_REQUESTS="9999999"
RATE_LIMITER_RATE_INTERVAL="1000"
RATE_LIMITER_RATE_INTERVAL_MILLIS="1000"
RATE_LIMITER_REDIS_HOST="localhost"
RATE_LIMITER_REDIS_PORT="6379"
RATE_LIMITER_TIMEOUT="300"
RATE_LIMITER_TIMEOUT_MILLIS="300"

EXPORT_ESERVICE_CONTAINER="interop-application-import-export-local"
EXPORT_ESERVICE_PATH="local/eservices-export"
Expand Down
4 changes: 2 additions & 2 deletions packages/commons-test/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ S3_SERVER_PORT=9000

RATE_LIMITER_BURST_PERCENTAGE="1.5"
RATE_LIMITER_MAX_REQUESTS="2"
RATE_LIMITER_RATE_INTERVAL="1000"
RATE_LIMITER_RATE_INTERVAL_MILLIS="1000"
RATE_LIMITER_REDIS_HOST="localhost"
RATE_LIMITER_REDIS_PORT="6379"
RATE_LIMITER_TIMEOUT="300"
RATE_LIMITER_TIMEOUT_MILLIS="300"
8 changes: 4 additions & 4 deletions packages/commons/src/config/redisRateLimiterConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export const RedisRateLimiterConfig = z
.object({
RATE_LIMITER_MAX_REQUESTS: z.coerce.number(),
RATE_LIMITER_BURST_PERCENTAGE: z.coerce.number(),
RATE_LIMITER_RATE_INTERVAL: z.coerce.number(),
RATE_LIMITER_RATE_INTERVAL_MILLIS: z.coerce.number(),
RATE_LIMITER_REDIS_HOST: z.string(),
RATE_LIMITER_REDIS_PORT: z.coerce.number().min(1001),
RATE_LIMITER_TIMEOUT: z.coerce.number(),
RATE_LIMITER_TIMEOUT_MILLIS: z.coerce.number(),
})
.transform((c) => ({
rateLimiterMaxRequests: c.RATE_LIMITER_MAX_REQUESTS,
rateLimiterBurstPercentage: c.RATE_LIMITER_BURST_PERCENTAGE,
rateLimiterRateInterval: c.RATE_LIMITER_RATE_INTERVAL,
rateLimiterRateInterval: c.RATE_LIMITER_RATE_INTERVAL_MILLIS,
rateLimiterRedisHost: c.RATE_LIMITER_REDIS_HOST,
rateLimiterRedisPort: c.RATE_LIMITER_REDIS_PORT,
rateLimiterTimeout: c.RATE_LIMITER_TIMEOUT,
rateLimiterTimeout: c.RATE_LIMITER_TIMEOUT_MILLIS,
}));
export type RedisRateLimiterConfig = z.infer<typeof RedisRateLimiterConfig>;

0 comments on commit f29fe76

Please sign in to comment.