connect issuer-type from browser
This commit is contained in:
parent
0a12bed545
commit
d35339a928
2 changed files with 12 additions and 9 deletions
|
@ -6,15 +6,14 @@
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
[dda.c4k-common.predicate :as pred]))
|
[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?
|
(defn ingress-type?
|
||||||
[input]
|
[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 ::ingress-type ingress-type?)
|
||||||
|
(s/def ::django-secret-key pred/bash-env-string?)
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :shynet [resource-name]
|
(defmethod yaml/load-resource :shynet [resource-name]
|
||||||
|
@ -32,7 +31,7 @@
|
||||||
(let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config]
|
(let [{:keys [fqdn django-secret-key postgres-db-user postgres-db-password]} config]
|
||||||
(->
|
(->
|
||||||
(yaml/from-string (yaml/load-resource "shynet/secret.yaml"))
|
(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 :ALLOWED_HOSTS] fqdn)
|
||||||
(assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key)
|
(assoc-in [:stringData :DJANGO_SECRET_KEY] django-secret-key)
|
||||||
(assoc-in [:stringData :DB_USER] postgres-db-user)
|
(assoc-in [:stringData :DB_USER] postgres-db-user)
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"provider"
|
"provider"
|
||||||
(concat-vec
|
(concat-vec
|
||||||
(br/generate-input-field "ingress-type" "(Optional) Your ingress type (traefik/ngingx):" "traefik")
|
(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
|
(generate-group
|
||||||
"credentials"
|
"credentials"
|
||||||
(br/generate-text-area
|
(br/generate-text-area
|
||||||
|
@ -61,19 +61,23 @@
|
||||||
|
|
||||||
(defn config-from-document []
|
(defn config-from-document []
|
||||||
(let [postgres-data-volume-path (br/get-content-from-element "postgres-data-volume-path" :optional true)
|
(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
|
(merge
|
||||||
{:fqdn (br/get-content-from-element "fqdn")}
|
{:fqdn (br/get-content-from-element "fqdn")}
|
||||||
(when (some? postgres-data-volume-path)
|
(when (some? postgres-data-volume-path)
|
||||||
{:postgres-data-volume-path postgres-data-volume-path})
|
{:postgres-data-volume-path postgres-data-volume-path})
|
||||||
(when (some? issuer)
|
(when (some? issuer)
|
||||||
{:issuer issuer})
|
{:issuer issuer})
|
||||||
|
(when (some? ingress-type)
|
||||||
|
{:ingress-type ingress-type})
|
||||||
)))
|
)))
|
||||||
|
|
||||||
(defn validate-all! []
|
(defn validate-all! []
|
||||||
(br/validate! "fqdn" ::shynet/fqdn)
|
(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! "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/validate! "auth" core/auth? :deserializer edn/read-string)
|
||||||
(br/set-validated!))
|
(br/set-validated!))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue