Use inline-resources macro
This commit is contained in:
parent
e6785784a7
commit
408376a5ca
6 changed files with 15 additions and 30 deletions
|
@ -103,7 +103,6 @@ package-native:
|
||||||
paths:
|
paths:
|
||||||
- target/graalvm
|
- target/graalvm
|
||||||
|
|
||||||
|
|
||||||
release-to-clojars:
|
release-to-clojars:
|
||||||
<<: *clj
|
<<: *clj
|
||||||
<<: *tag_only
|
<<: *tag_only
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"src/test/cljc"
|
"src/test/cljc"
|
||||||
"src/test/cljs"
|
"src/test/cljs"
|
||||||
"src/test/resources"]
|
"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"]]
|
[hickory "0.7.1"]]
|
||||||
:builds {:frontend {:target :browser
|
:builds {:frontend {:target :browser
|
||||||
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}
|
:modules {:main {:init-fn dda.c4k-nextcloud.browser/init}}
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
(ns dda.c4k-nextcloud.backup
|
(ns dda.c4k-nextcloud.backup
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
#?(:cljs [shadow.resource :as rc])
|
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-common.base64 :as b64]
|
[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-access-key-id cp/bash-env-string?)
|
||||||
(s/def ::aws-secret-access-key cm/bash-env-string?)
|
(s/def ::aws-secret-access-key cp/bash-env-string?)
|
||||||
(s/def ::restic-password cm/bash-env-string?)
|
(s/def ::restic-password cp/bash-env-string?)
|
||||||
(s/def ::restic-repository cm/bash-env-string?)
|
(s/def ::restic-repository cp/bash-env-string?)
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :backup [resource-name]
|
(defmethod yaml/load-resource :backup [resource-name]
|
||||||
(case resource-name
|
(get (inline-resources "backup") 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!")))))
|
|
||||||
|
|
||||||
(defn generate-config [my-conf]
|
(defn generate-config [my-conf]
|
||||||
(let [{:keys [restic-repository]} my-conf]
|
(let [{:keys [restic-repository]} my-conf]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(ns dda.c4k-nextcloud.core
|
(ns dda.c4k-nextcloud.core
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
|
||||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns dda.c4k-nextcloud.nextcloud
|
(ns dda.c4k-nextcloud.nextcloud
|
||||||
(:require
|
(:require
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
#?(:cljs [shadow.resource :as rc])
|
|
||||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
|
@ -10,7 +9,8 @@
|
||||||
[dda.c4k-common.predicate :as cp]
|
[dda.c4k-common.predicate :as cp]
|
||||||
[dda.c4k-common.postgres :as postgres]
|
[dda.c4k-common.postgres :as postgres]
|
||||||
[dda.c4k-common.common :as cm]
|
[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 ::fqdn cp/fqdn-string?)
|
||||||
(s/def ::issuer cp/letsencrypt-issuer?)
|
(s/def ::issuer cp/letsencrypt-issuer?)
|
||||||
|
@ -35,12 +35,7 @@
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :nextcloud [resource-name]
|
(defmethod yaml/load-resource :nextcloud [resource-name]
|
||||||
(case resource-name
|
(get (inline-resources "nextcloud") 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!")))))
|
|
||||||
|
|
||||||
(defn-spec generate-deployment cp/map-or-seq?
|
(defn-spec generate-deployment cp/map-or-seq?
|
||||||
[config config?]
|
[config config?]
|
||||||
|
|
|
@ -2,21 +2,17 @@
|
||||||
(:require
|
(:require
|
||||||
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
:cljs [cljs.test :refer-macros [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.alpha :as s]
|
||||||
[clojure.spec.test.alpha :as st]
|
[clojure.spec.test.alpha :as st]
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[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)
|
(st/instrument)
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :nextcloud-test [resource-name]
|
(defmethod yaml/load-resource :nextcloud-test [resource-name]
|
||||||
(case resource-name
|
(get (inline-resources "nextcloud-test") 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"))))
|
|
||||||
|
|
||||||
(deftest validate-valid-resources
|
(deftest validate-valid-resources
|
||||||
(is (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/valid-config.yaml")))
|
(is (s/valid? cut/config? (yaml/load-as-edn "nextcloud-test/valid-config.yaml")))
|
||||||
|
|
Loading…
Reference in a new issue