Compare commits
2 commits
b96f51220d
...
5c583fd72f
Author | SHA1 | Date | |
---|---|---|---|
5c583fd72f | |||
21dee3cfc0 |
1 changed files with 21 additions and 1 deletions
|
@ -3,14 +3,19 @@
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
|
[dda.backup.core.domain :as cd]
|
||||||
|
[dda.backup.restic.domain :as rd]
|
||||||
[cljc.java-time.local-date :as ld]
|
[cljc.java-time.local-date :as ld]
|
||||||
[cljc.java-time.format.date-time-formatter :as df]))
|
[cljc.java-time.format.date-time-formatter :as df]))
|
||||||
|
|
||||||
(s/def ::new-password-file string?)
|
(s/def ::new-password-file string?)
|
||||||
|
(s/def ::config (s/keys :req-un [::rd/restic-repository
|
||||||
|
::rd/password-file]
|
||||||
|
:opt-un [::rd/certificate-file
|
||||||
|
::new-password-file]))
|
||||||
|
|
||||||
(def lowercase-numeric #"[a-z0-9]+")
|
(def lowercase-numeric #"[a-z0-9]+")
|
||||||
(def alphanumeric #"[a-zA-Z0-9]+")
|
(def alphanumeric #"[a-zA-Z0-9]+")
|
||||||
|
|
||||||
; true | false
|
; true | false
|
||||||
(s/def ::current boolean?)
|
(s/def ::current boolean?)
|
||||||
; 521e0760
|
; 521e0760
|
||||||
|
@ -33,6 +38,21 @@
|
||||||
|
|
||||||
; Refer to "docs/CredentialRotation.md" for specifics
|
; Refer to "docs/CredentialRotation.md" for specifics
|
||||||
|
|
||||||
|
(defn-spec list-passwords-command ::cd/command
|
||||||
|
[config ::config]
|
||||||
|
(let [{:keys [restic-repository password-file
|
||||||
|
certificate-file new-password-file]} config]
|
||||||
|
(into
|
||||||
|
[]
|
||||||
|
(concat ["restic" "-r" restic-repository "key" "list" "--json"]
|
||||||
|
(cond
|
||||||
|
(some? certificate-file)
|
||||||
|
["--cacert" certificate-file]
|
||||||
|
(some? password-file)
|
||||||
|
["--password-file" password-file]
|
||||||
|
:else
|
||||||
|
[])))))
|
||||||
|
|
||||||
(defn-spec add-new-password! nil?
|
(defn-spec add-new-password! nil?
|
||||||
[new-password-file ::new-password-file]
|
[new-password-file ::new-password-file]
|
||||||
; TODO
|
; TODO
|
||||||
|
|
Loading…
Reference in a new issue