From 5664853ca7501e939b31a0ca728159506a2434b1 Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 12 Aug 2022 09:37:57 +0200 Subject: [PATCH] Allow service-domain-whitelist to be blank string --- src/main/cljc/dda/c4k_gitea/gitea.cljc | 11 +++++++++-- src/main/cljs/dda/c4k_gitea/browser.cljs | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/cljc/dda/c4k_gitea/gitea.cljc b/src/main/cljc/dda/c4k_gitea/gitea.cljc index 23c829d..81349bf 100644 --- a/src/main/cljc/dda/c4k_gitea/gitea.cljc +++ b/src/main/cljc/dda/c4k_gitea/gitea.cljc @@ -1,6 +1,7 @@ (ns dda.c4k-gitea.gitea (:require - [clojure.spec.alpha :as s] + [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?) diff --git a/src/main/cljs/dda/c4k_gitea/browser.cljs b/src/main/cljs/dda/c4k_gitea/browser.cljs index 174d1bb..e6efc6c 100644 --- a/src/main/cljs/dda/c4k_gitea/browser.cljs +++ b/src/main/cljs/dda/c4k_gitea/browser.cljs @@ -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! []