Skip to content

Commit

Permalink
elastic
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Mar 23, 2024
1 parent e8bb33b commit 7a94b1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ LIGHTNING_RESERVE_FEE_MIN=2000
# Rate limit requests to mint. Make sure that you can see request IPs in the logs.
# You may need to adjust your reverse proxy if you only see requests originating from 127.0.0.1
# MINT_RATE_LIMIT=TRUE
# MINT_GLOBAL_RATE_LIMIT_PER_MINUTE=20
# Determines the number of all requests allowed per minute per IP
# MINT_GLOBAL_RATE_LIMIT_PER_MINUTE=60
# Determines the number of transactions (mint, melt, swap) allowed per minute per IP
# MINT_TRANSACTION_RATE_LIMIT_PER_MINUTE=20
2 changes: 2 additions & 0 deletions cashu/mint/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ def get_remote_address_excluding_local(request: Request) -> str:

limiter_global = Limiter(
key_func=get_remote_address_excluding_local,
strategy="fixed-window-elastic-expiry",
default_limits=[f"{settings.mint_global_rate_limit_per_minute}/minute"],
enabled=settings.mint_rate_limit,
)

limiter = Limiter(
key_func=get_remote_address_excluding_local,
strategy="fixed-window-elastic-expiry",
default_limits=[f"{settings.mint_transaction_rate_limit_per_minute}/minute"],
enabled=settings.mint_rate_limit,
)

0 comments on commit 7a94b1b

Please sign in to comment.