Skip to content

Commit

Permalink
psql link fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LobbyLobster committed Mar 18, 2024
1 parent 29cf61e commit 2f2ce39
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions backup/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ func getPSQLList() []string {
}
psqlArgs := []string{"-lqt"}
if params.Remote.IsRemote {
pglink := "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + ":" + remote.Port
var pglink string
if remote.Port != "" {
pglink = "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + ":" + remote.Port + "/postgres"
} else {
pglink = "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + "/postgres"
}
psqlArgs = append(psqlArgs, pglink)
}
cmd := exec.Command("/usr/bin/psql", psqlArgs...)
Expand Down Expand Up @@ -66,7 +71,12 @@ func dumpPSQLDb(db string, dst string) (string, string, error) {

var pgDumpArgs []string
if remote.IsRemote {
pglink := "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + ":" + remote.Port + "/" + db
var pglink string
if remote.Port != "" {
pglink = "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + ":" + remote.Port + "/" + db
} else {
pglink = "postgresql://" + remote.User + ":" + remote.Password + "@" + remote.Host + "/" + db
}
pgDumpArgs = append(pgDumpArgs, pglink)
} else {
pgDumpArgs = append(pgDumpArgs, db)
Expand Down

0 comments on commit 2f2ce39

Please sign in to comment.