From a85e3c3b2433f06eec29741c4ddc5e0a61f6439f Mon Sep 17 00:00:00 2001 From: jerger Date: Wed, 28 Dec 2022 08:40:08 +0100 Subject: [PATCH] add ability to either consume yaml or edn --- package.json | 2 +- project-cljs.clj | 2 +- project.clj | 2 +- src/main/clj/dda/c4k_common/uberjar.clj | 7 +++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9263dbc..5a0c014 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/project-cljs.clj b/project-cljs.clj index cf5a0bb..f330fd1 100644 --- a/project-cljs.clj +++ b/project-cljs.clj @@ -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" diff --git a/project.clj b/project.clj index 1f5dc70..65a83cd 100644 --- a/project.clj +++ b/project.clj @@ -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" diff --git a/src/main/clj/dda/c4k_common/uberjar.clj b/src/main/clj/dda/c4k_common/uberjar.clj index 44ec7b7..85c9301 100644 --- a/src/main/clj/dda/c4k_common/uberjar.clj +++ b/src/main/clj/dda/c4k_common/uberjar.clj @@ -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?)