Skip to content

Commit

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

type PostgresSource struct {
Host string `yaml:"Host"`
Port string `yaml:"Port"`
User string `yaml:"User"`
Password string `yaml:"Password"`
Database string `yaml:"Database"`
Host string `yaml:"Host"`
Port string `yaml:"Port"`
User string `yaml:"User"`
Password string `yaml:"Password"`
Database string `yaml:"Database"`
PgdumpExtraArgs []string `yaml:"PgdumpExtraArgs"`
}

func (s PostgresSource) Validate() error {
Expand All @@ -35,12 +36,16 @@ func (s PostgresSource) Validate() error {
}

func (s PostgresSource) Backup() (backup_output.BackupOutput, error) {
args := []string{
"host=" + s.Host +
" port=" + s.Port +
" user=" + s.User +
" password=" + s.Password +
" dbname=" + s.Database,
}
args = append(s.PgdumpExtraArgs, args...)
return backup_process_utils.BackupProcessExecToFile(
"pg_dump",
"host="+s.Host+
" port="+s.Port+
" user="+s.User+
" password="+s.Password+
" dbname="+s.Database,
args...,
)
}

0 comments on commit 817cbdb

Please sign in to comment.