mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 11:58:02 +00:00
34 lines
719 B
Go
34 lines
719 B
Go
|
package backup
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
func getBackupCommand(
|
||
|
timestamp string,
|
||
|
databases []string,
|
||
|
bucketName string,
|
||
|
backupName string,
|
||
|
) string {
|
||
|
|
||
|
backupCommands := make([]string, 0)
|
||
|
if timestamp != "" {
|
||
|
backupCommands = append(backupCommands, "export "+backupNameEnv+"="+timestamp)
|
||
|
} else {
|
||
|
backupCommands = append(backupCommands, "export "+backupNameEnv+"=$(date +%Y-%m-%dT%H:%M:%SZ)")
|
||
|
}
|
||
|
|
||
|
for _, database := range databases {
|
||
|
backupCommands = append(backupCommands,
|
||
|
strings.Join([]string{
|
||
|
"/scripts/backup.sh",
|
||
|
backupName,
|
||
|
bucketName,
|
||
|
database,
|
||
|
backupPath,
|
||
|
secretPath,
|
||
|
certPath,
|
||
|
"${" + backupNameEnv + "}",
|
||
|
}, " "))
|
||
|
}
|
||
|
return strings.Join(backupCommands, " && ")
|
||
|
}
|