refactor to separate config & auth
This commit is contained in:
parent
8f714c3bdd
commit
d4fb8ca9e2
4 changed files with 43 additions and 32 deletions
|
@ -5,7 +5,7 @@
|
||||||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.11.3"]
|
:dependencies [[org.clojure/clojure "1.11.3"]
|
||||||
[org.clojure/tools.reader "1.4.2"]
|
[org.clojure/tools.reader "1.4.2"]
|
||||||
[org.domaindrivenarchitecture/c4k-common-clj "7.0.0"]
|
[org.domaindrivenarchitecture/c4k-common-clj "8.0.0"]
|
||||||
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
|
[hickory "0.7.1" :exclusions [viebel/codox-klipse-theme]]]
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"src/test/cljc"
|
"src/test/cljc"
|
||||||
"src/test/cljs"
|
"src/test/cljs"
|
||||||
"src/test/resources"]
|
"src/test/resources"]
|
||||||
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.3.1"]
|
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "8.0.0"]
|
||||||
[hickory "0.7.1"]]
|
[hickory "0.7.1"]]
|
||||||
:builds {:frontend {:target :browser
|
:builds {:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.c4k-jitsi.browser/init}}
|
:modules {:main {:init-fn dda.c4k-jitsi.browser/init}}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
[dda.c4k-jitsi.core :as core]))
|
[dda.c4k-jitsi.core :as core]))
|
||||||
|
|
||||||
(defn -main [& cmd-args]
|
(defn -main [& cmd-args]
|
||||||
(uberjar/main-common
|
(uberjar/main-cm
|
||||||
"c4k-jitsi"
|
"c4k-jitsi"
|
||||||
core/config?
|
core/config?
|
||||||
core/auth?
|
core/auth?
|
||||||
core/config-defaults
|
core/config-defaults
|
||||||
core/k8s-objects
|
core/config-objects
|
||||||
|
core/auth-objects
|
||||||
cmd-args))
|
cmd-args))
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
(ns dda.c4k-jitsi.core
|
(ns dda.c4k-jitsi.core
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
[dda.c4k-common.predicate :as cp]
|
[dda.c4k-common.predicate :as cp]
|
||||||
[dda.c4k-common.monitoring :as mon]
|
[dda.c4k-common.monitoring :as mon]
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-jitsi.jitsi :as jitsi]
|
[dda.c4k-jitsi.jitsi :as jitsi]
|
||||||
[dda.c4k-common.namespace :as ns]))
|
[dda.c4k-common.namespace :as ns]))
|
||||||
|
|
||||||
(def config-defaults {:issuer "staging", :namespace "jitsi"})
|
(def config-defaults {:issuer "staging", :namespace "jitsi"})
|
||||||
|
|
||||||
|
@ -24,25 +24,35 @@
|
||||||
::jitsi/jicofo-component-secret]
|
::jitsi/jicofo-component-secret]
|
||||||
:opt-un [::mon-auth]))
|
:opt-un [::mon-auth]))
|
||||||
|
|
||||||
(defn-spec k8s-objects cp/map-or-seq?
|
(defn-spec config-objects cp/map-or-seq?
|
||||||
|
[config config?]
|
||||||
|
(map yaml/to-string
|
||||||
|
(filter
|
||||||
|
#(not (nil? %))
|
||||||
|
(cm/concat-vec
|
||||||
|
(ns/generate config)
|
||||||
|
[(jitsi/generate-jvb-service config)
|
||||||
|
(jitsi/generate-web-service config)
|
||||||
|
(jitsi/generate-etherpad-service config)
|
||||||
|
(jitsi/generate-excalidraw-backend-service config)
|
||||||
|
(jitsi/generate-meapp-fullstack-service config)
|
||||||
|
(jitsi/generate-deployment config)
|
||||||
|
(jitsi/generate-excalidraw-deployment config)
|
||||||
|
(jitsi/generate-meapp-deployment config)]
|
||||||
|
(jitsi/generate-ingress-web config)
|
||||||
|
(jitsi/generate-ingress-etherpad config)
|
||||||
|
(jitsi/generate-ingress-meapp-fullstack config)
|
||||||
|
(when (:contains? config :mon-cfg)
|
||||||
|
(mon/generate-config))))))
|
||||||
|
|
||||||
|
(defn-spec auth-objects cp/map-or-seq?
|
||||||
[config config?
|
[config config?
|
||||||
auth auth?]
|
auth auth?]
|
||||||
(map yaml/to-string
|
(map yaml/to-string
|
||||||
(filter
|
(filter
|
||||||
#(not (nil? %))
|
#(not (nil? %))
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
[(ns/generate config)
|
[(jitsi/generate-secret-jitsi config auth)]
|
||||||
(jitsi/generate-secret-jitsi auth)
|
|
||||||
(jitsi/generate-jvb-service)
|
|
||||||
(jitsi/generate-web-service)
|
|
||||||
(jitsi/generate-etherpad-service)
|
|
||||||
(jitsi/generate-excalidraw-backend-service)
|
|
||||||
(jitsi/generate-meapp-fullstack-service)
|
|
||||||
(jitsi/generate-deployment config)
|
|
||||||
(jitsi/generate-excalidraw-deployment)
|
|
||||||
(jitsi/generate-meapp-deployment)]
|
|
||||||
(jitsi/generate-ingress-web config)
|
|
||||||
(jitsi/generate-ingress-etherpad config)
|
|
||||||
(jitsi/generate-ingress-meapp-fullstack config)
|
|
||||||
(when (:contains? config :mon-cfg)
|
(when (:contains? config :mon-cfg)
|
||||||
(mon/generate-config (:mon-cfg config) (:mon-auth auth)))))))
|
(mon/generate-auth (:mon-cfg config) (:mon-auth auth)))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue