yaml multimethod, added postgres

merge-requests/1/merge
bom 3 years ago
parent 67631747ae
commit 930e520c42

@ -2,7 +2,7 @@
"name": "c4k-common-cljs",
"description": "Contains predicates and tools for c4k",
"author": "meissa GmbH",
"version": "0.1.0-SNAPSHOT",
"version": "0.2.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 "0.1.0-SNAPSHOT"
(defproject org.domaindrivenarchitecture/c4k-common-cljs "0.2.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 "0.1.0-SNAPSHOT"
(defproject org.domaindrivenarchitecture/c4k-common-clj "0.2.0-SNAPSHOT"
:description "Contains predicates and tools for c4k"
:url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0"

@ -1,6 +1,7 @@
(ns dda.c4k-common.postgres
(:require
[clojure.spec.alpha :as s]
#?(:cljs [shadow.resource :as rc])
[dda.c4k-common.yaml :as yaml]
[dda.c4k-common.base64 :as b64]
[dda.c4k-common.common :as cm]))
@ -9,8 +10,19 @@
(s/def ::postgres-db-password cm/bash-env-string?)
(s/def ::postgres-data-volume-path string?)
#?(:cljs
(defmethod yaml/load-resource :postgres [resource-name]
(case resource-name
"postgres/config.yaml" (rc/inline "postgres/config.yaml")
"postgres/deployment.yaml" (rc/inline "postgres/deployment.yaml")
"postgres/persistent-volume.yaml" (rc/inline "postgres/persistent-volume.yaml")
"postgres/pvc.yaml" (rc/inline "postgres/pvc.yaml")
"postgres/secret.yaml" (rc/inline "postgres/secret.yaml")
"postgres/service.yaml" (rc/inline "postgres/service.yaml")
(throw (js/Error. "Undefined Resource!")))))
(defn generate-config []
(yaml/from-string (yaml/load-resource "postgres/config.yaml")))
(yaml/from-string (yaml/load-resource "postgres/config.yaml")))
(defn generate-deployment []
(yaml/from-string (yaml/load-resource "postgres/deployment.yaml")))

Loading…
Cancel
Save