rate-limit #3

Merged
patdyn merged 23 commits from rate-limit into main 2024-01-23 09:02:07 +00:00
Showing only changes of commit 4881ea3c0d - Show all commits

View file

@ -138,7 +138,7 @@
; using :average and :burst seems sensible, :period may be interesting for fine tuning later on ; using :average and :burst seems sensible, :period may be interesting for fine tuning later on
(defn-spec generate-rate-limit-middleware pred/map-or-seq? (defn-spec generate-rate-limit-middleware pred/map-or-seq?
[config rate-limit-config?] [config rate-limit-config?]
(let [{:keys [max-rate max-concurrent-requests]} config] ; ToDo: Set defaults, don't read config ; refactor ":average" KW to smth more speaking (let [{:keys [max-rate max-concurrent-requests]} config]
(-> (->
(yaml/load-as-edn "forgejo/middleware-ratelimit.yaml") (yaml/load-as-edn "forgejo/middleware-ratelimit.yaml")
(cm/replace-key-value :average max-rate) (cm/replace-key-value :average max-rate)