From 20380ba19357e8633ffb8b163311d5601f90d43e Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Fri, 12 Nov 2021 11:11:14 +0100 Subject: [PATCH] Upgraded c4k-common --- project.clj | 2 +- shadow-cljs.edn | 2 +- src/main/cljc/dda/c4k_nextcloud/core.cljc | 7 +++++-- src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc | 2 +- src/test/cljc/dda/c4k_nextcloud/core_test.cljc | 18 ++++++++++++++++-- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/project.clj b/project.clj index 39f5d8c..ff1da27 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.10.3"] [org.clojure/tools.reader "1.3.4"] - [org.domaindrivenarchitecture/c4k-common-clj "0.3.2-SNAPSHOT"]] + [org.domaindrivenarchitecture/c4k-common-clj "1.0.0"]] :target-path "target/%s/" :source-paths ["src/main/cljc" "src/main/clj"] diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 6bea133..4860c84 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -4,7 +4,7 @@ "src/test/cljc" "src/test/cljs" "src/test/resources"] - :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "0.4.3"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.0.0"] [hickory "0.7.1"]] :builds {:frontend {:target :browser :modules {:main {:init-fn dda.c4k-nextcloud.browser/init}} diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index 620d739..cf4d191 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -21,10 +21,13 @@ ::aws-access-key-id ::aws-secret-access-key ::restic-password])) -(defn k8s-objects [config] + + +(defn-spec k8s-objects any? + [config (s/merge config? auth?)] (into [] - (concat [(yaml/to-string (postgres/generate-config :postgres-size :8gb)) + (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) (yaml/to-string (postgres/generate-secret config))] (when (contains? config :postgres-data-volume-path) [(yaml/to-string (postgres/generate-persistent-volume config))]) diff --git a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc index f7cfc7c..c5b9031 100644 --- a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc @@ -4,7 +4,7 @@ #?(:cljs [shadow.resource :as rc]) [dda.c4k-common.yaml :as yaml] [dda.c4k-common.base64 :as b64] - [dda.c4k-common.prefixes :as cp] + [dda.c4k-common.predicate :as cp] [dda.c4k-common.common :as cm])) (s/def ::fqdn cp/fqdn-string?) diff --git a/src/test/cljc/dda/c4k_nextcloud/core_test.cljc b/src/test/cljc/dda/c4k_nextcloud/core_test.cljc index 964476c..27d3fbb 100644 --- a/src/test/cljc/dda/c4k_nextcloud/core_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/core_test.cljc @@ -2,7 +2,9 @@ (:require #?(:clj [clojure.test :refer [deftest is are testing run-tests]] :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) - [dda.c4k-nextcloud.core :as cut])) + [clojure.string :as st] + [dda.c4k-nextcloud.core :as cut] + )) (deftest should-k8s-objects (is (= 16 @@ -38,4 +40,16 @@ :issuer :prod :aws-access-key-id "aws-id" :aws-secret-access-key "aws-secret" - :restic-password "restic-pw"}))))) + :restic-password "restic-pw"})))) + (is (st/includes? + (get-in (cut/k8s-objects {:fqdn "nextcloud-neu.prod.meissa-gmbh.de" + :postgres-db-user "nextcloud" + :postgres-db-password "nextcloud-db-password" + :nextcloud-admin-user "cloudadmin" + :nextcloud-admin-password "cloudpassword" + :issuer :prod + :aws-access-key-id "aws-id" + :aws-secret-access-key "aws-secret" + :restic-password "restic-pw"}) + [0]) + "max_connections = 700")))