mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-21 22:54:48 +01:00
chore: use limits from JWT if available
This commit is contained in:
@@ -153,8 +153,17 @@ func main() {
|
||||
logMw := transport.CreateLoggingMiddleware(logger)
|
||||
// strict rate limit for requests for sending payments
|
||||
strictRateLimitMiddleware := transport.CreateRateLimitMiddleware(c.StrictRateLimit, c.BurstRateLimit)
|
||||
secured := e.Group("", tokens.Middleware(c.JWTSecret), logMw)
|
||||
securedWithStrictRateLimit := e.Group("", tokens.Middleware(c.JWTSecret), strictRateLimitMiddleware, logMw)
|
||||
|
||||
limits := &lnd.Limits{
|
||||
MaxSendVolume: c.MaxSendVolume,
|
||||
MaxSendAmount: c.MaxSendAmount,
|
||||
MaxReceiveVolume: c.MaxReceiveVolume,
|
||||
MaxReceiveAmount: c.MaxReceiveAmount,
|
||||
MaxAccountBalance: c.MaxAccountBalance,
|
||||
}
|
||||
|
||||
secured := e.Group("", tokens.Middleware(c.JWTSecret, limits), logMw)
|
||||
securedWithStrictRateLimit := e.Group("", tokens.Middleware(c.JWTSecret, limits), strictRateLimitMiddleware, logMw)
|
||||
|
||||
transport.RegisterLegacyEndpoints(svc, e, secured, securedWithStrictRateLimit, strictRateLimitMiddleware, tokens.AdminTokenMiddleware(c.AdminToken), logMw)
|
||||
transport.RegisterV2Endpoints(svc, e, secured, securedWithStrictRateLimit, strictRateLimitMiddleware, tokens.AdminTokenMiddleware(c.AdminToken), logMw)
|
||||
|
||||
Reference in New Issue
Block a user