Moved letsencrypt-issuer? back to c4k-common

This commit is contained in:
Clemens Geibel 2022-05-11 14:20:43 +02:00
parent 5b4e68ae2a
commit 9f94116777
2 changed files with 4 additions and 10 deletions

View file

@ -5,7 +5,7 @@
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"] :dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.6"] [org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "1.1.1-SNAPSHOT"]] [org.domaindrivenarchitecture/c4k-common-clj "2.0.0-SNAPSHOT"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"
"src/main/clj"] "src/main/clj"]

View file

@ -10,14 +10,8 @@
[dda.c4k-common.common :as cm] [dda.c4k-common.common :as cm]
[dda.c4k-common.postgres :as postgres])) [dda.c4k-common.postgres :as postgres]))
; TODO: Replace method in c4k-common.predicate and update all c4k modules.
(defn letsencrypt-issuer?
[input]
(contains? #{"prod" "staging"} input))
; TODO: Remove (name ...) function calls, when issuer is no longer a keyword (also in c4k-common)
(s/def ::fqdn cp/fqdn-string?) (s/def ::fqdn cp/fqdn-string?)
(s/def ::issuer letsencrypt-issuer?) ;cp/letsencrypt-issuer? (s/def ::issuer cp/letsencrypt-issuer?)
(s/def ::restic-repository string?) (s/def ::restic-repository string?)
(s/def ::nextcloud-data-volume-path string?) (s/def ::nextcloud-data-volume-path string?)
(s/def ::nextcloud-admin-user cp/bash-env-string?) (s/def ::nextcloud-admin-user cp/bash-env-string?)
@ -44,7 +38,7 @@
(defn generate-certificate [config] (defn generate-certificate [config]
(let [{:keys [fqdn issuer]} config (let [{:keys [fqdn issuer]} config
letsencrypt-issuer (name issuer)] letsencrypt-issuer issuer]
(-> (->
(yaml/from-string (yaml/load-resource "nextcloud/certificate.yaml")) (yaml/from-string (yaml/load-resource "nextcloud/certificate.yaml"))
(assoc-in [:spec :commonName] fqdn) (assoc-in [:spec :commonName] fqdn)
@ -59,7 +53,7 @@
(defn generate-ingress [config] (defn generate-ingress [config]
(let [{:keys [fqdn issuer] (let [{:keys [fqdn issuer]
:or {issuer "staging"}} config :or {issuer "staging"}} config
letsencrypt-issuer (name issuer)] letsencrypt-issuer issuer]
(-> (->
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml")) (yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))
(assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer) (assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer)