From 051f15223221f3244d558e12aeac518b63aa94fa Mon Sep 17 00:00:00 2001
From: Michael Jerger <michael.jerger@meissa-gmbh.de>
Date: Sat, 11 Jan 2025 13:32:09 +0100
Subject: [PATCH] add restic-new password

---
 src/main/cljc/dda/c4k_nextcloud/backup.cljc              | 4 +++-
 src/main/resources/backup/backup-restore-deployment.yaml | 2 ++
 src/main/resources/backup/secret.yaml                    | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/cljc/dda/c4k_nextcloud/backup.cljc b/src/main/cljc/dda/c4k_nextcloud/backup.cljc
index e9ba9de..a985295 100644
--- a/src/main/cljc/dda/c4k_nextcloud/backup.cljc
+++ b/src/main/cljc/dda/c4k_nextcloud/backup.cljc
@@ -10,6 +10,7 @@
 (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-new-password cp/bash-env-string?)
 (s/def ::restic-repository cp/bash-env-string?)
 
 #?(:cljs
@@ -27,7 +28,8 @@
 
 (defn generate-backup-restore-deployment [my-conf]
   (let [backup-restore-yaml (yaml/load-as-edn "backup/backup-restore-deployment.yaml")]
-    (if (and (contains? my-conf :local-integration-test) (= true (:local-integration-test my-conf)))
+    (if (and (contains? my-conf :local-integration-test) 
+             (= true (:local-integration-test my-conf)))
       (cm/replace-named-value backup-restore-yaml "CERTIFICATE_FILE" "/var/run/secrets/localstack-secrets/ca.crt")
       backup-restore-yaml)))
 
diff --git a/src/main/resources/backup/backup-restore-deployment.yaml b/src/main/resources/backup/backup-restore-deployment.yaml
index 26a4ebe..7e8d0a0 100644
--- a/src/main/resources/backup/backup-restore-deployment.yaml
+++ b/src/main/resources/backup/backup-restore-deployment.yaml
@@ -57,6 +57,8 @@ spec:
               key: restic-repository
         - name: RESTIC_PASSWORD_FILE
           value: /var/run/secrets/backup-secrets/restic-password
+        - name: RESTIC_NEW_PASSWORD_FILE
+          value: /var/run/secrets/backup-secrets/restic-new-password
         - name: CERTIFICATE_FILE
           value: ""
         volumeMounts:
diff --git a/src/main/resources/backup/secret.yaml b/src/main/resources/backup/secret.yaml
index 02a03eb..c706b1b 100644
--- a/src/main/resources/backup/secret.yaml
+++ b/src/main/resources/backup/secret.yaml
@@ -7,4 +7,5 @@ type: Opaque
 data:
   aws-access-key-id: "aws-access-key-id"
   aws-secret-access-key: "aws-secret-access-key"
-  restic-password: "restic-password"
\ No newline at end of file
+  restic-password: "restic-password"
+  restic-new-password: "restic-new-password"
\ No newline at end of file