Use common yaml

This commit is contained in:
bom 2023-01-20 13:53:35 +01:00
parent 337fa68592
commit 349eb9dfc5
3 changed files with 1 additions and 65 deletions

View file

@ -1,20 +0,0 @@
(ns dda.c4k-keycloak.yaml
(:require
[clojure.java.io :as io]
[clj-yaml.core :as yaml]
[clojure.walk]))
(defn cast-lazy-seq-to-vec
[lazy-seq]
(clojure.walk/postwalk #(if (instance? clojure.lang.LazySeq %)
(into [] %)
%) lazy-seq))
(defn load-resource [resource-name]
(slurp (io/resource resource-name)))
(defn from-string [input]
(cast-lazy-seq-to-vec (yaml/parse-string input)))
(defn to-string [edn]
(yaml/generate-string edn :dumper-options {:flow-style :block}))

View file

@ -1,7 +1,7 @@
(ns dda.c4k-keycloak.keycloak (ns dda.c4k-keycloak.keycloak
(:require (:require
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[dda.c4k-keycloak.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-common.base64 :as b64] [dda.c4k-common.base64 :as b64]
[dda.c4k-common.common :as cm])) [dda.c4k-common.common :as cm]))

View file

@ -1,44 +0,0 @@
(ns dda.c4k-keycloak.yaml
(:require
["js-yaml" :as yaml]
[shadow.resource :as rc]))
(def postgres-config (rc/inline "postgres/config.yaml"))
(def postgres-secret (rc/inline "postgres/secret.yaml"))
(def postgres-deployment (rc/inline "postgres/deployment.yaml"))
(def postgres-service (rc/inline "postgres/service.yaml"))
(def keycloak-secret (rc/inline "keycloak/secret.yaml"))
(def keycloak-deployment (rc/inline "keycloak/deployment.yaml"))
(def keycloak-certificate (rc/inline "keycloak/certificate.yaml"))
(def keycloak-ingress (rc/inline "keycloak/ingress.yaml"))
(def keycloak-service (rc/inline "keycloak/service.yaml"))
(def ingress-test (rc/inline "ingress_test.yaml"))
(defn load-resource [resource-name]
(case resource-name
"postgres/config.yaml" postgres-config
"postgres/secret.yaml" postgres-secret
"postgres/deployment.yaml" postgres-deployment
"postgres/service.yaml" postgres-service
"keycloak/secret.yaml" keycloak-secret
"keycloak/deployment.yaml" keycloak-deployment
"keycloak/certificate.yaml" keycloak-certificate
"keycloak/ingress.yaml" keycloak-ingress
"keycloak/service.yaml" keycloak-service
"ingress_test.yaml" ingress-test))
(defn from-string [input]
(js->clj (yaml/load input)
:keywordize-keys true))
(defn to-string [edn]
(yaml/dump (clj->js edn)))