fix browser

This commit is contained in:
jerger 2022-12-28 18:26:49 +01:00
parent 9b9c9cc444
commit 1324b7788f

View file

@ -1,9 +1,11 @@
(ns dda.c4k-jitsi.browser (ns dda.c4k-jitsi.browser
(:require (:require
[clojure.tools.reader.edn :as edn] [clojure.tools.reader.edn :as edn]
[dda.c4k-common.monitoring :as mon]
[dda.c4k-common.common :as cm]
[dda.c4k-common.browser :as br]
[dda.c4k-jitsi.core :as core] [dda.c4k-jitsi.core :as core]
[dda.c4k-jitsi.jitsi :as jitsi] [dda.c4k-jitsi.jitsi :as jitsi]))
[dda.c4k-common.browser :as br]))
(defn generate-content [] (defn generate-content []
(cm/concat-vec (cm/concat-vec
@ -12,15 +14,21 @@
(cm/concat-vec (cm/concat-vec
(br/generate-group (br/generate-group
"domain" "domain"
(cm/concat-vec (cm/concat-vec
(br/generate-input-field "fqdn" "Your fqdn:" "jitsi.prod.meissa-gmbh.de") (br/generate-input-field "fqdn" "Your fqdn:" "jitsi.prod.meissa-gmbh.de")
(br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" ""))) (br/generate-input-field "issuer" "(Optional) Your issuer prod/staging:" "")
(br/generate-input-field "mon-cluster-name" "(Optional) monitoring cluster name:" "jitsi")
(br/generate-input-field "mon-cluster-stage" "(Optional) monitoring cluster stage:" "test")
(br/generate-input-field "mon-cloud-url" "(Optional) grafana cloud url:" "https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push")
))
(br/generate-group (br/generate-group
"credentials" "credentials"
(br/generate-text-area "auth" "Your auth.edn:" "{:jvb-auth-password \"jitsi\" (br/generate-text-area "auth" "Your auth.edn:" "{:jvb-auth-password \"jitsi\"
:jicofo-auth-password \"jicofo-password\" :jicofo-auth-password \"jicofo-password\"
:jicofo-component-secret \"jicofo-component-secrect\"}" :jicofo-component-secret \"jicofo-component-secrect\"
"5")) :mon-auth {:grafana-cloud-user \"your-user-id\"
:grafana-cloud-password \"your-cloud-password\"}}}"
"5"))
[(br/generate-br)] [(br/generate-br)]
(br/generate-button "generate-button" "Generate c4k yaml")))] (br/generate-button "generate-button" "Generate c4k yaml")))]
(br/generate-output "c4k-jitsi-output" "Your c4k deployment.yaml:" "25"))) (br/generate-output "c4k-jitsi-output" "Your c4k deployment.yaml:" "25")))
@ -33,16 +41,26 @@
(generate-content)}) (generate-content)})
(defn config-from-document [] (defn config-from-document []
(let [issuer (br/get-content-from-element "issuer" :optional true :deserializer keyword)] (let [issuer (br/get-content-from-element "issuer" :optional true)
mon-cluster-name (br/get-content-from-element "mon-cluster-name" :optional true)
mon-cluster-stage (br/get-content-from-element "mon-cluster-stage" :optional true :deserializer keyword)
mon-cloud-url (br/get-content-from-element "mon-cloud-url" :optional true)]
(merge (merge
{:fqdn (br/get-content-from-element "fqdn")} {:fqdn (br/get-content-from-element "fqdn")}
(when (some? issuer) (when (some? issuer)
{:issuer issuer}) {:issuer issuer})
(when (some? mon-cluster-name)
{:mon-cfg {:cluster-name mon-cluster-name
:cluster-stage (keyword mon-cluster-stage)
:grafana-cloud-url mon-cloud-url}})
))) )))
(defn validate-all! [] (defn validate-all! []
(br/validate! "fqdn" ::jitsi/fqdn) (br/validate! "fqdn" ::jitsi/fqdn)
(br/validate! "issuer" ::jitsi/issuer :optional true :deserializer keyword) (br/validate! "issuer" ::jitsi/issuer :optional true)
(br/validate! "mon-cluster-name" ::mon/cluster-name :optional true)
(br/validate! "mon-cluster-stage" ::mon/cluster-stage :optional true :deserializer keyword)
(br/validate! "mon-cloud-url" ::mon/grafana-cloud-url :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!))