connect issuer-type from browser

This commit is contained in:
jerger 2022-02-11 14:40:32 +01:00
parent 0a12bed545
commit d35339a928
2 changed files with 12 additions and 9 deletions

View file

@ -6,15 +6,14 @@
[dda.c4k-common.common :as cm]
[dda.c4k-common.predicate :as pred]))
(s/def ::fqdn pred/fqdn-string?)
(s/def ::issuer pred/letsencrypt-issuer?)
(s/def ::django-secret-key pred/bash-env-string?)
(defn ingress-type?
[input]
(contains? #{:traefik :default} input))
(contains? #{:traefik :nginx} input))
(s/def ::fqdn pred/fqdn-string?)
(s/def ::issuer pred/letsencrypt-issuer?)
(s/def ::ingress-type ingress-type?)
(s/def ::django-secret-key pred/bash-env-string?)
#?(:cljs
(defmethod yaml/load-resource :shynet [resource-name]
@ -32,7 +31,7 @@
(let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config]
(->
(yaml/from-string (yaml/load-resource "shynet/secret.yaml"))
; See comment in secret.yaml
; TODO: See comment in secret.yaml
;(assoc-in [:stringData :ALLOWED_HOSTS] fqdn)
(assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key)
(assoc-in [:stringData :DB_USER] postgres-db-user)

View file

@ -39,7 +39,7 @@
"provider"
(concat-vec
(br/generate-input-field "ingress-type" "(Optional) Your ingress type (traefik/ngingx):" "traefik")
(br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path:" "/var/postgres")))
(br/generate-input-field "postgres-data-volume-path" "(Optional) Your postgres-data-volume-path if Persistent Volumes are not generated by an Operator:" "")))
(generate-group
"credentials"
(br/generate-text-area
@ -61,19 +61,23 @@
(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)
ingress-type (br/get-content-from-element "ingress-type" :optional true :deserializer keyword)]
(merge
{:fqdn (br/get-content-from-element "fqdn")}
(when (some? postgres-data-volume-path)
{:postgres-data-volume-path postgres-data-volume-path})
(when (some? issuer)
{:issuer issuer})
(when (some? ingress-type)
{:ingress-type ingress-type})
)))
(defn validate-all! []
(br/validate! "fqdn" ::shynet/fqdn)
(br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true)
(br/validate! "issuer" ::shynet/issuer :optional true :deserializer keyword)
(br/validate! "ingress-type" ::shynet/ingress-type :optional true)
(br/validate! "postgres-data-volume-path" ::pgc/postgres-data-volume-path :optional true)
(br/validate! "auth" core/auth? :deserializer edn/read-string)
(br/set-validated!))