(ns dda.backup.backup (:require [orchestra.core :refer [defn-spec]] [clojure.spec.alpha :as s] [dda.backup.backup.domain :as domain] [dda.backup.restic :as restic] [dda.backup.infrastructure :as i])) (s/def ::backup-file-config (s/merge ::restic/restic-config (s/keys :req-un [::domain/files] :opt-un []))) (defn-spec backup-file! nil? [config ::backup-file-config] (let [config-w-defaults (merge restic/default config)] (restic/unlock! config-w-defaults) (i/execute! (domain/backup-files-command config-w-defaults) config-w-defaults) (restic/forget! config-w-defaults) ))