[WIP] Use defaults for rate limit

This commit is contained in:
erik 2024-01-19 10:14:44 +01:00
parent aec67352d5
commit 62fb2a37a0

View file

@ -9,6 +9,7 @@
[dda.c4k-common.postgres :as postgres])) [dda.c4k-common.postgres :as postgres]))
(def config-defaults {:issuer "staging", :deploy-federated "false"}) (def config-defaults {:issuer "staging", :deploy-federated "false"})
(def rate-limit-defaults {:max-rate 10, :max-concurrent-requests 5})
(def config? (s/keys :req-un [::forgejo/fqdn (def config? (s/keys :req-un [::forgejo/fqdn
::forgejo/mailer-from ::forgejo/mailer-from
@ -30,7 +31,7 @@
(def vol? (s/keys :req-un [::forgejo/volume-total-storage-size])) (def vol? (s/keys :req-un [::forgejo/volume-total-storage-size]))
(defn k8s-objects [config auth] (defn k8s-objects [config auth] ; ToDo: ADR for generate functions - vector or no vector?
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)]
(map yaml/to-string (map yaml/to-string
(filter #(not (nil? %)) (filter #(not (nil? %))
@ -49,13 +50,9 @@
(forgejo/generate-service-ssh) (forgejo/generate-service-ssh)
(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) ; ToDo: just leave this out and make sensible defaults (forgejo/generate-rate-limit-middleware rate-limit-defaults)] ; this does not have a vector as output
(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)
[(forgejo/generate-rate-limit-middleware config)]) ; this does not
(when (not (contains? config :average))
(forgejo/generate-ingress-and-cert config))
(when (contains? config :restic-repository) (when (contains? config :restic-repository)
[(backup/generate-config config) [(backup/generate-config config)
(backup/generate-secret auth) (backup/generate-secret auth)