class

MartenThrottle::Settings

Inherits Marten::Conf::Settings < Reference < Object

Configuration namespace for marten-throttle.

Accessed via Marten.settings.throttle. Per-route rules and path exclusions are declared inside a #draw block; unmatched requests are throttled only when default_policy is set:

Marten.settings.throttle.default_policy = MartenThrottle::Policy.new(limit: 100, per: 1.minute)

Marten.settings.throttle.draw do
  exclude "/health"
  rule "login", "/login", limit: 5, per: 1.minute, methods: ["POST"]
end

Class methods

validate_limit!(limit : Int32) : Nil
Source
validate_rule_name!(name : String) : Nil
Source
validate_window!(window : Time::Span) : Nil
Source

Instance methods

cache_namespace
Source
cache_namespace=(cache_namespace : String)
Source
client_identifier
Source
client_identifier=(client_identifier : ClientIdentifier | Nil)
Source
clock
Source
clock=(clock : Clock)
Source
default_policy
Source
default_policy=(default_policy : Policy | Nil)
Source
default_strategy
Source
default_strategy=(default_strategy : StrategyName)
Source
draw
Source
enabled=(enabled : Bool)
Source
enabled?
Source
exclude(matcher : PathMatcher::Matcher) : PathMatcher
Source
exclusions
Source
exclusions=(exclusions : Array(PathMatcher))
Source
fail_open=(fail_open : Bool)
Source
fail_open?
Source
remote_address
Source
remote_address=(remote_address : RemoteAddress | Nil)
Source
rule(name : String, matcher : Rule::Matcher, limit : Int32, per : Time::Span, strategy : StrategyName = default_strategy, methods : Array(String) | Nil = nil, identifier : ClientIdentifier | Nil = nil) : Rule
Source
rules
Source
rules=(rules : Array(Rule))
Source
skip_if
Source
skip_if=(skip_if : SkipPredicate | Nil)
Source
trust_forwarded_headers=(trust_forwarded_headers : Bool)
Source
trust_forwarded_headers?
Source

Nested types