diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f0d1eb..4c1d6c8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,7 +103,6 @@ package-native: paths: - target/graalvm - release-to-clojars: <<: *clj <<: *tag_only diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 1eb1c54..e409ee5 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 "6.0.3"] + :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.1.3"] [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/backup.cljc b/src/main/cljc/dda/c4k_nextcloud/backup.cljc index 1ef1694..e9ba9de 100644 --- a/src/main/cljc/dda/c4k_nextcloud/backup.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/backup.cljc @@ -1,24 +1,20 @@ (ns dda.c4k-nextcloud.backup (: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])) + [dda.c4k-common.common :as cm] + [dda.c4k-common.predicate :as cp] + #?(:cljs [dda.c4k-common.macros :refer-macros [inline-resources]]))) -(s/def ::aws-access-key-id cm/bash-env-string?) -(s/def ::aws-secret-access-key cm/bash-env-string?) -(s/def ::restic-password cm/bash-env-string?) -(s/def ::restic-repository cm/bash-env-string?) +(s/def ::aws-access-key-id cp/bash-env-string?) +(s/def ::aws-secret-access-key cp/bash-env-string?) +(s/def ::restic-password cp/bash-env-string?) +(s/def ::restic-repository cp/bash-env-string?) #?(:cljs (defmethod yaml/load-resource :backup [resource-name] - (case resource-name - "backup/config.yaml" (rc/inline "backup/config.yaml") - "backup/cron.yaml" (rc/inline "backup/cron.yaml") - "backup/secret.yaml" (rc/inline "backup/secret.yaml") - "backup/backup-restore-deployment.yaml" (rc/inline "backup/backup-restore-deployment.yaml") - (throw (js/Error. "Undefined Resource!"))))) + (get (inline-resources "backup") resource-name))) (defn generate-config [my-conf] (let [{:keys [restic-repository]} my-conf] diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index 32fb75d..897f9eb 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -1,6 +1,5 @@ (ns dda.c4k-nextcloud.core (:require - [clojure.spec.alpha :as s] #?(:clj [orchestra.core :refer [defn-spec]] :cljs [orchestra.core :refer-macros [defn-spec]]) [dda.c4k-common.common :as cm] diff --git a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc index f6fb875..d1ac832 100644 --- a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc @@ -1,7 +1,6 @@ (ns dda.c4k-nextcloud.nextcloud (:require [clojure.spec.alpha :as s] - #?(:cljs [shadow.resource :as rc]) #?(:clj [orchestra.core :refer [defn-spec]] :cljs [orchestra.core :refer-macros [defn-spec]]) [dda.c4k-common.yaml :as yaml] @@ -10,7 +9,8 @@ [dda.c4k-common.predicate :as cp] [dda.c4k-common.postgres :as postgres] [dda.c4k-common.common :as cm] - [dda.c4k-common.monitoring :as mon])) + [dda.c4k-common.monitoring :as mon] + #?(:cljs [dda.c4k-common.macros :refer-macros [inline-resources]]))) (s/def ::fqdn cp/fqdn-string?) (s/def ::issuer cp/letsencrypt-issuer?) @@ -35,12 +35,7 @@ #?(:cljs (defmethod yaml/load-resource :nextcloud [resource-name] - (case resource-name - "nextcloud/deployment.yaml" (rc/inline "nextcloud/deployment.yaml") - "nextcloud/pvc.yaml" (rc/inline "nextcloud/pvc.yaml") - "nextcloud/service.yaml" (rc/inline "nextcloud/service.yaml") - "nextcloud/secret.yaml" (rc/inline "nextcloud/secret.yaml") - (throw (js/Error. "Undefined Resource!"))))) + (get (inline-resources "nextcloud") resource-name))) (defn-spec generate-deployment cp/map-or-seq? [config config?] diff --git a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc index ef053cf..a266426 100644 --- a/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc +++ b/src/test/cljc/dda/c4k_nextcloud/nextcloud_test.cljc @@ -2,21 +2,17 @@ (:require #?(:clj [clojure.test :refer [deftest is are testing run-tests]] :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) - #?(:cljs [shadow.resource :as rc]) [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st] [dda.c4k-common.yaml :as yaml] - [dda.c4k-nextcloud.nextcloud :as cut])) + [dda.c4k-nextcloud.nextcloud :as cut] + #?(:cljs [dda.c4k-common.macros :refer-macros [inline-resources]]))) (st/instrument) #?(:cljs (defmethod yaml/load-resource :nextcloud-test [resource-name] - (case resource-name - "nextcloud-test/valid-auth.yaml" (rc/inline "nextcloud-test/valid-auth.yaml") - "nextcloud-test/valid-config.yaml" (rc/inline "nextcloud-test/valid-config.yaml") - "nextcloud-test/invalid-auth.yaml" (rc/inline "nextcloud-test/invalid-auth.yaml") - "nextcloud-test/invalid-config.yaml" (rc/inline "nextcloud-test/invalid-config.yaml")))) + (get (inline-resources "nextcloud-test") resource-name))) (deftest validate-valid-resources (is (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/valid-config.yaml")))