@@ -163,31 +163,46 @@ func (b Backup) backupContainer(ctx context.Context, options *BackupContainerOpt
163163func getBackupCommand (jobConfig * JobConfig ) ([]string , string ) {
164164 if jobConfig .Config ["dbType" ] == "postgres" {
165165
166- cmd := []string {"pg_dump" , "-c" , "-w" }
166+ cmd := []string {"pg_dump" }
167167
168168 // default to postgres user
169169 pgUser := "postgres"
170+
171+ // if we have a custom user, use it
170172 if jobConfig .Config ["dbUser" ] != "" {
171173
172174 log .Debugf ("Using custom postgres user: %s" , jobConfig .Config ["dbUser" ])
173175 pgUser = jobConfig .Config ["dbUser" ]
174176 } else {
175177 log .Debugf ("Using default postgres user: %s" , jobConfig .Config ["dbUser" ])
176178 }
179+ // add the user to the command
177180 cmd = append (cmd , "-U" , pgUser )
178181
179- // if we have a password, we need to pass it to the command
182+ // if we have a password, we need add the password flag
180183 if jobConfig .Config ["dbPassword" ] != "" {
181184 cmd = append (cmd , "--password" )
182185 }
183186
187+ // add additional args to the command
188+ if jobConfig .Config ["dbAdditionalArgs" ] != "" {
189+ cmd = append (cmd , jobConfig .Config ["dbAdditionalArgs" ])
190+ }
191+
184192 // https://www.postgresql.org/docs/current/app-pg-dumpall.html
185193 return cmd , jobConfig .Config ["dbPassword" ]
186194 }
187195
196+ // if jobConfig.Config["dbType"] == "mariadb" {
197+ // cmd := []string{"mariadb-dump"}
198+
199+ // return cmd, jobConfig.Config["dbPassword"]
200+ // }
201+
188202 return []string {"echo" , "Unknown db type" }, ""
189203}
190204
205+ // generate the backup file name
191206func getBackupFileName (jobConfig * JobConfig , containerName string ) string {
192207 // currentTime := time.Now()
193208
0 commit comments