diff --git a/README.md b/README.md index c0cf0f5..9993c42 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,15 @@ List all backups and their size ### show-queue Print a list of VMs that will be backed up when `schedule` is run. This list is in order of priority. VMs without a backup are first, followed by the VMs who's backups are the oldest. +### upload-disk-media +Upload a virtual hard disk file (tested with VHDX and qcow2) to the media section of Scale. You can then use the GUI to create disks based on it. + +### show-disks +List disks attached to a VM. This is mostly so you know which uuid to use in the next command. + +### clone-disk +Create a copy-on-write clone of a disk currently attached to one VM and attach it to another VM. This does not transfer the disk over the network, so it's fairly quick. + ## scale-backup.toml (Config File) The following locations will be searched for a config file in order: 1. `SCALE_BACKUP_CONFIG` environment variable @@ -93,6 +102,10 @@ PostSchedule = '/path/to/program {{LocalPath}}' # until the hook finished. If this is set to true, PostBackup hooks will be # queued and run one-by-one, right before the PostSchedule hook. DelayPostBackupWhenScheduled = false + +[Debug] +LogFile = '/absolute/path/to/log/file' # optional +RedactPasswords = true # optional, default false ``` ### CertFingerprint diff --git a/debug.go b/debug.go index 0a614d1..61b6797 100644 --- a/debug.go +++ b/debug.go @@ -7,6 +7,7 @@ import ( "io" "net/http" "os" + "regexp" "runtime" "strings" "sync" @@ -26,10 +27,7 @@ func writeToLogFile(logEntry string) { // truncate log file if necessary if !logFileTruncated { - err := os.Truncate(Config.Debug.LogFile, 0) - if err != nil { - panic(err) - } + os.Truncate(Config.Debug.LogFile, 0) logFileTruncated = true } @@ -113,12 +111,8 @@ func DebugHTTP(c *http.Client, r *http.Request) (*http.Response, error) { r.Body = io.NopCloser(bytes.NewReader(reqBody)) } if Config.Debug.RedactPasswords { - reqBody = bytes.Replace( - reqBody, - []byte(Config.SMB.Password), - []byte("REDACTED"), - 1, - ) + r := regexp.MustCompile("smb://[^@]+@") + reqBody = r.ReplaceAll(reqBody, []byte("smb://@")) } if len(reqBody) > 0 { logEntry.WriteString(fmt.Sprintf(