Skip to content

Commit

Permalink
feat(backup/source/postgres_server): Add PgdumpallExtraArgs config param
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Jan 12, 2023
1 parent 817cbdb commit 923779c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions backup/source/postgres_server/postgres_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
)

type PostgresServerSource struct {
Host string `yaml:"Host"`
Port string `yaml:"Port"`
User string `yaml:"User"`
Password string `yaml:"Password"`
Host string `yaml:"Host"`
Port string `yaml:"Port"`
User string `yaml:"User"`
Password string `yaml:"Password"`
PgdumpallExtraArgs []string `yaml:"PgdumpallExtraArgs"`
}

func (s PostgresServerSource) Validate() error {
Expand All @@ -34,12 +35,16 @@ func (s PostgresServerSource) Validate() error {
func (s PostgresServerSource) Backup() (backup_output.BackupOutput, error) {
env := os.Environ()
env = append(env, "PGPASSWORD="+s.Password)
return backup_process_utils.BackupProcessExecEnvToFile(
env,
"pg_dumpall",
args := []string{
"--host", s.Host,
"--port", s.Port,
"--user", s.User,
"--no-password",
}
args = append(s.PgdumpallExtraArgs, args...)
return backup_process_utils.BackupProcessExecEnvToFile(
env,
"pg_dumpall",
args...,
)
}

0 comments on commit 923779c

Please sign in to comment.