Changed issuer keywords to strings

This commit is contained in:
Clemens Geibel 2022-04-20 16:51:57 +02:00
parent 775689b348
commit 5b4e68ae2a
6 changed files with 17 additions and 11 deletions

View file

@ -9,7 +9,7 @@
[dda.c4k-nextcloud.nextcloud :as nextcloud]
[dda.c4k-nextcloud.backup :as backup]))
(def config-defaults {:issuer :staging})
(def config-defaults {:issuer "staging"})
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
::nextcloud/nextcloud-admin-user ::nextcloud/nextcloud-admin-password

View file

@ -10,8 +10,14 @@
[dda.c4k-common.common :as cm]
[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 ::issuer cp/letsencrypt-issuer?)
(s/def ::issuer letsencrypt-issuer?) ;cp/letsencrypt-issuer?
(s/def ::restic-repository string?)
(s/def ::nextcloud-data-volume-path string?)
(s/def ::nextcloud-admin-user cp/bash-env-string?)
@ -52,7 +58,7 @@
(defn generate-ingress [config]
(let [{:keys [fqdn issuer]
:or {issuer :staging}} config
:or {issuer "staging"}} config
letsencrypt-issuer (name issuer)]
(->
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))

View file

@ -13,7 +13,7 @@
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer :prod
:issuer "prod"
:nextcloud-data-volume-path "/var/nextcloud"
:postgres-data-volume-path "/var/postgres"
:aws-access-key-id "aws-id"
@ -26,7 +26,7 @@
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer :prod
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"
@ -37,7 +37,7 @@
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer :prod
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"}))))
@ -47,7 +47,7 @@
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer :prod
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"})
@ -59,7 +59,7 @@
:postgres-db-password "nextcloud-db-password"
:nextcloud-admin-user "cloudadmin"
:nextcloud-admin-password "cloudpassword"
:issuer :prod
:issuer "prod"
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"})

View file

@ -25,7 +25,7 @@
:dnsNames ["xx"]
:issuerRef
{:name "prod", :kind "ClusterIssuer"}}}
(cut/generate-certificate {:fqdn "xx" :issuer :prod}))))
(cut/generate-certificate {:fqdn "xx" :issuer "prod"}))))
(deftest should-generate-ingress
(is (= {:apiVersion "networking.k8s.io/v1"

View file

@ -1,5 +1,5 @@
{:fqdn "cloud.test.meissa-gmbh.de"
:issuer :staging
:issuer "staging"
:nextcloud-data-volume-path "/var/cloud"
:postgres-data-volume-path "/var/postgres"
:restic-repository "s3:s3.amazonaws.com/your-bucket/your-folder"}

View file

@ -1,5 +1,5 @@
fqdn: "cloud.test.meissa-gmbh.de"
issuer: :staging
issuer: "staging"
nextcloud-data-volume-path: "/var/cloud"
postgres-data-volume-path: "/var/postgres"
restic-repository: "s3:s3.amazonaws.com/your-bucket/your-folder"