add mor doc related to change passwd

This commit is contained in:
Michael Jerger 2025-01-24 14:58:37 +01:00
parent c17bb85ebc
commit 0f99623f68

View file

@ -25,6 +25,7 @@
(s/def ::check-result #{:initialized :wrong-password :not-initialized :error})
(defn-spec check ::check-result
"Check a restic repository whether it is initialized and there are correct credentials given."
[restic-config ::restic-config]
(let [config-w-defaults (merge core/default restic-config)]
(try
@ -39,19 +40,23 @@
:default :error))))))
(defn-spec use-new-password? boolean?
"Check, whether a given new password should b used instead of the normal one."
[restic-config ::restic-config]
(if (contains? restic-config :new-password-file)
(= :initialized (check (merge restic-config {:password-file (:new-password-file restic-config)})))
false))
(defn- config-w-defaults
"Merge given configuration with defaults & replace restic-password with restic-new-password if necessary."
[restic-config]
(if (use-new-password? restic-config)
(merge default restic-config {:password-file (:new-password-file restic-config)})
(merge default restic-config)))
(defn-spec initalized? boolean?
"deprecated"
(defn-spec
^{:deprecated "0.2.0"
:superseded-by "check"}
initalized? boolean?
[restic-config ::restic-config]
(let [config-2-use (config-w-defaults restic-config)]
(= :initialized (check config-2-use))))