Add spec for mailer

This commit is contained in:
bom 2022-07-22 10:51:27 +02:00
parent 0a6919f4f9
commit de7bd6200e

View file

@ -1,6 +1,7 @@
(ns dda.c4k-gitea.gitea
(:require
[clojure.spec.alpha :as s]
[clojure.string :as str]
#?(:cljs [shadow.resource :as rc])
#?(:clj [orchestra.core :refer [defn-spec]]
:cljs [orchestra.core :refer-macros [defn-spec]])
@ -12,6 +13,16 @@
(s/def ::fqdn pred/fqdn-string?)
(s/def ::issuer pred/letsencrypt-issuer?)
(s/def ::mailer-from pred/bash-env-string?)
; TODO: Move to pred/host-port?
(s/def ::mailer-host-port #(let [split-string (str/split % #":")]
(and (= (count split-string) 2)
(pred/fqdn-string? (first split-string))
; TODO: Move this to pred/port-number?
(let [snd (second split-string)]
(and (integer? snd)
(> 0 snd)
(<= 65535 snd))))))
(s/def ::mailer-user pred/bash-env-string?)
(s/def ::mailer-pw pred/bash-env-string?)