Allow service-domain-whitelist to be blank string
This commit is contained in:
parent
8e8e6a0d70
commit
5664853ca7
2 changed files with 16 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
(ns dda.c4k-gitea.gitea
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as st]
|
||||
#?(:cljs [shadow.resource :as rc])
|
||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||
|
@ -12,11 +13,17 @@
|
|||
[dda.c4k-common.predicate :as pred]
|
||||
[dda.c4k-common.postgres :as postgres]))
|
||||
|
||||
(defn domain-list?
|
||||
[input]
|
||||
(or
|
||||
(st/blank? input)
|
||||
(pred/string-of-separated-by? pred/fqdn-string? #"," input)))
|
||||
|
||||
(s/def ::default-app-name string?)
|
||||
(s/def ::fqdn pred/fqdn-string?)
|
||||
(s/def ::mailer-from pred/bash-env-string?)
|
||||
(s/def ::mailer-host-port pred/host-and-port-string?)
|
||||
(s/def ::service-domain-whitelist #(pred/string-of-separated-by? pred/fqdn-string? #"," %))
|
||||
(s/def ::service-domain-whitelist domain-list?)
|
||||
(s/def ::service-noreply-address string?)
|
||||
(s/def ::mailer-user pred/bash-env-string?)
|
||||
(s/def ::mailer-pw pred/bash-env-string?)
|
||||
|
|
|
@ -63,7 +63,9 @@
|
|||
|
||||
(defn config-from-document []
|
||||
(let [postgres-data-volume-path (br/get-content-from-element "postgres-data-volume-path" :optional true)
|
||||
issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)]
|
||||
issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)
|
||||
app-name (br/get-content-from-element "app-name" :optional true)
|
||||
domain-whitelist (br/get-content-from-element "domain-whitelist" :optional true)]
|
||||
(js/console.log postgres-data-volume-path)
|
||||
(merge
|
||||
{:fqdn (br/get-content-from-element "fqdn")}
|
||||
|
@ -71,6 +73,10 @@
|
|||
{:postgres-data-volume-path postgres-data-volume-path})
|
||||
(when (not (st/blank? issuer))
|
||||
{:issuer issuer})
|
||||
(when (not (st/blank? app-name))
|
||||
{:default-app-name app-name})
|
||||
(when (not (st/blank? domain-whitelist))
|
||||
{:service-domain-whitelist domain-whitelist})
|
||||
)))
|
||||
|
||||
(defn validate-all! []
|
||||
|
|
Loading…
Reference in a new issue