rate-limit #3
2 changed files with 3 additions and 3 deletions
|
@ -50,7 +50,7 @@
|
||||||
(forgejo/generate-data-volume config)
|
(forgejo/generate-data-volume config)
|
||||||
(forgejo/generate-appini-env config)
|
(forgejo/generate-appini-env config)
|
||||||
(forgejo/generate-secrets auth)]
|
(forgejo/generate-secrets auth)]
|
||||||
(when (contains? config :average)
|
(when (contains? config :average) ; ToDo: just leave this out and make sensible defaults
|
||||||
(forgejo/generate-rate-limit-ingress-and-cert config)) ; this function has a vector as output
|
(forgejo/generate-rate-limit-ingress-and-cert config)) ; this function has a vector as output
|
||||||
(when (contains? config :average)
|
(when (contains? config :average)
|
||||||
[(forgejo/generate-rate-limit-middleware config)]) ; this does not
|
[(forgejo/generate-rate-limit-middleware config)]) ; this does not
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
(s/def ::mailer-pw pred/bash-env-string?)
|
(s/def ::mailer-pw pred/bash-env-string?)
|
||||||
(s/def ::issuer pred/letsencrypt-issuer?)
|
(s/def ::issuer pred/letsencrypt-issuer?)
|
||||||
(s/def ::volume-total-storage-size (partial pred/int-gt-n? 5))
|
(s/def ::volume-total-storage-size (partial pred/int-gt-n? 5))
|
||||||
(s/def ::average int?)
|
(s/def ::average int?)
|
||||||
(s/def ::burst int?)
|
(s/def ::burst int?)
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::fqdn
|
(def config? (s/keys :req-un [::fqdn
|
||||||
|
@ -137,7 +137,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 config?]
|
[config config?]
|
||||||
(let [{:keys [average burst]} config]
|
(let [{:keys [average burst]} config] ; ToDo: Set defaults, don't read config ; refactor ":average" KW to smth more speaking
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "forgejo/middleware-ratelimit.yaml")
|
(yaml/load-as-edn "forgejo/middleware-ratelimit.yaml")
|
||||||
(cm/replace-key-value :average average)
|
(cm/replace-key-value :average average)
|
||||||
|
|
Loading…
Reference in a new issue