Improve postgres credentials
This commit is contained in:
parent
f028a4b4fd
commit
5ac161f4d4
3 changed files with 5 additions and 4 deletions
|
@ -21,7 +21,8 @@
|
||||||
(defn-spec create-pg-pass! nil?
|
(defn-spec create-pg-pass! nil?
|
||||||
[config ::pg-config]
|
[config ::pg-config]
|
||||||
(let [config-w-defaults (merge default config)]
|
(let [config-w-defaults (merge default config)]
|
||||||
(spit "/root/.pgpass" (domain/pgpass config-w-defaults))))
|
(spit "/root/.pgpass" (domain/pgpass config-w-defaults))
|
||||||
|
(i/execute! ["chmod" "0600" "/root/.pgpass"] config)))
|
||||||
|
|
||||||
(defn-spec drop-create-db! nil?
|
(defn-spec drop-create-db! nil?
|
||||||
[config ::pg-config]
|
[config ::pg-config]
|
||||||
|
|
|
@ -67,8 +67,8 @@
|
||||||
|
|
||||||
(defn-spec pgpass string?
|
(defn-spec pgpass string?
|
||||||
[config ::pg-config]
|
[config ::pg-config]
|
||||||
(let [{:keys [pg-host pg-db pg-user pg-password]} config]
|
(let [{:keys [pg-host pg-port pg-db pg-user pg-password]} config]
|
||||||
(str pg-host ":" pg-db ":" pg-user ":" pg-password)))
|
(str pg-host ":" pg-port ":" pg-db ":" pg-user ":" pg-password)))
|
||||||
|
|
||||||
(defn-spec db-drop-create-command ::cd/commands
|
(defn-spec db-drop-create-command ::cd/commands
|
||||||
[config ::pg-config]
|
[config ::pg-config]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(st/instrument `cut/db-drop-create-command)
|
(st/instrument `cut/db-drop-create-command)
|
||||||
|
|
||||||
(deftest should-calculate-pgpass
|
(deftest should-calculate-pgpass
|
||||||
(is (= "localhost:mydb:user:password"
|
(is (= "localhost:5432:mydb:user:password"
|
||||||
(cut/pgpass {:restic-repository "repo"
|
(cut/pgpass {:restic-repository "repo"
|
||||||
:backup-path "dir-at-repo"
|
:backup-path "dir-at-repo"
|
||||||
:pg-host "localhost"
|
:pg-host "localhost"
|
||||||
|
|
Loading…
Reference in a new issue