Split Config and Auth

This commit is contained in:
patdyn 2024-08-08 11:38:16 +02:00
parent 7ff6f20fce
commit 9f2ee663bd
2 changed files with 22 additions and 11 deletions

View file

@ -7,10 +7,11 @@
(set! *warn-on-reflection* true) (set! *warn-on-reflection* true)
(defn -main [& cmd-args] (defn -main [& cmd-args]
(uberjar/main-common (uberjar/main-cm
"c4k-keycloak" "c4k-keycloak"
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))

View file

@ -30,18 +30,28 @@
::postgres/postgres-db-user ::postgres/postgres-db-password] ::postgres/postgres-db-user ::postgres/postgres-db-password]
:opt-un [::mon/mon-auth])) :opt-un [::mon/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)
(postgres/generate-config config)
[(kc/generate-service config)
(kc/generate-deployment config)]
(kc/generate-ingress 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) (postgres/generate-auth config auth)
(postgres/generate config auth) [(kc/generate-secret config auth)]
[(kc/generate-secret config auth) (when (and (contains? auth :mon-auth) (contains? config :mon-cfg))
(kc/generate-service config) (mon/generate-auth (:mon-config config) (:mon-auth auth)))))))
(kc/generate-deployment config)]
(kc/generate-ingress config)
(when (:contains? config :mon-cfg)
(mon/generate (:mon-cfg config) (:mon-auth auth)))))))