Compare commits
No commits in common. "c4ce3cd275b4047fa49e0b79d3342ff5502e22bc" and "f028a4b4fdf4d8ccea388a447f44e026f4b4a42e" have entirely different histories.
c4ce3cd275
...
f028a4b4fd
4 changed files with 5 additions and 23 deletions
|
@ -2,7 +2,7 @@
|
|||
(:require
|
||||
[orchestra.core :refer [defn-spec]]
|
||||
[clojure.spec.alpha :as s]
|
||||
[dda.backup.infrastructure :as i]))
|
||||
[clojure.string :as st]))
|
||||
|
||||
(def default {:dry-run false
|
||||
:debug false})
|
||||
|
@ -13,12 +13,6 @@
|
|||
::debug
|
||||
::execution-directory]))
|
||||
|
||||
(s/def ::aws-access-key-id string?)
|
||||
(s/def ::aws-secret-access-key string?)
|
||||
(s/def ::aws-config
|
||||
(s/keys :req-un [::aws-access-key-id
|
||||
::aws-secret-access-key]))
|
||||
|
||||
(defn-spec env-or-file string?
|
||||
[name string?]
|
||||
(let [from-env (System/getenv name)
|
||||
|
@ -28,14 +22,3 @@
|
|||
(some? name-from-file) (slurp name-from-file)
|
||||
:else (throw ( RuntimeException.
|
||||
(str "Environment: [" name "," name-from-file "] was missing." ))))))
|
||||
|
||||
|
||||
(defn-spec create-aws-credentials! nil?
|
||||
[config ::aws-config]
|
||||
(let [{:keys [aws-access-key-id aws-secret-access-key]} config]
|
||||
(i/execute! [["mkdir" "/root/.aws"]] {})
|
||||
(spit "/root/.aws/credentials"
|
||||
(str "[default]\n"
|
||||
"aws_access_key_id=" aws-access-key-id "\n"
|
||||
"aws_secret_access_key=" aws-secret-access-key "\n"))
|
||||
(i/execute! [["chmod" "0600" "/root/.aws/credentials"]] {})))
|
|
@ -21,8 +21,7 @@
|
|||
(defn-spec create-pg-pass! nil?
|
||||
[config ::pg-config]
|
||||
(let [config-w-defaults (merge default config)]
|
||||
(spit "/root/.pgpass" (domain/pgpass config-w-defaults))
|
||||
(i/execute! [["chmod" "0600" "/root/.pgpass"]] config)))
|
||||
(spit "/root/.pgpass" (domain/pgpass config-w-defaults))))
|
||||
|
||||
(defn-spec drop-create-db! nil?
|
||||
[config ::pg-config]
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
|
||||
(defn-spec pgpass string?
|
||||
[config ::pg-config]
|
||||
(let [{:keys [pg-host pg-port pg-db pg-user pg-password]} config]
|
||||
(str pg-host ":" pg-port ":" pg-db ":" pg-user ":" pg-password)))
|
||||
(let [{:keys [pg-host pg-db pg-user pg-password]} config]
|
||||
(str pg-host ":" pg-db ":" pg-user ":" pg-password)))
|
||||
|
||||
(defn-spec db-drop-create-command ::cd/commands
|
||||
[config ::pg-config]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(st/instrument `cut/db-drop-create-command)
|
||||
|
||||
(deftest should-calculate-pgpass
|
||||
(is (= "localhost:5432:mydb:user:password"
|
||||
(is (= "localhost:mydb:user:password"
|
||||
(cut/pgpass {:restic-repository "repo"
|
||||
:backup-path "dir-at-repo"
|
||||
:pg-host "localhost"
|
||||
|
|
Loading…
Reference in a new issue