add ability to either consume yaml or edn

pull/1/head
jerger 1 year ago
parent b42b8a0bb8
commit a85e3c3b24

@ -2,7 +2,7 @@
"name": "c4k-common-cljs",
"description": "Contains predicates and tools for c4k",
"author": "meissa GmbH",
"version": "4.0.1-SNAPSHOT",
"version": "4.1.0-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-common#readme",
"repository": "https://www.npmjs.com/package/c4k-common",
"license": "APACHE2",

@ -1,4 +1,4 @@
(defproject org.domaindrivenarchitecture/c4k-common-cljs "4.0.1-SNAPSHOT"
(defproject org.domaindrivenarchitecture/c4k-common-cljs "4.1.0-SNAPSHOT"
:description "Contains predicates and tools for c4k"
:url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0"

@ -1,4 +1,4 @@
(defproject org.domaindrivenarchitecture/c4k-common-clj "4.0.1-SNAPSHOT"
(defproject org.domaindrivenarchitecture/c4k-common-clj "4.1.0-SNAPSHOT"
:description "Contains predicates and tools for c4k"
:url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0"

@ -4,6 +4,7 @@
[clojure.spec.alpha :as s]
[clojure.string :as cs]
[clojure.tools.reader.edn :as edn]
[dda.c4k-common.yaml :as yaml]
[dda.c4k-common.common :as cm]
[dda.c4k-common.core :as core]
[expound.alpha :as expound]))
@ -39,8 +40,10 @@
:else
(let [config-str (slurp config)
auth-str (slurp auth)
config-edn (edn/read-string config-str)
auth-edn (edn/read-string auth-str)
config-parse-fn (if (yaml/is-yaml? config) yaml/from-string edn/read-string)
auth-parse-fn (if (yaml/is-yaml? auth) yaml/from-string edn/read-string)
config-edn (config-parse-fn config-str)
auth-edn (auth-parse-fn auth-str)
config-valid? (s/valid? config-spec? config-edn)
auth-valid? (s/valid? auth-spec? auth-edn)]
(if (and config-valid? auth-valid?)

Loading…
Cancel
Save