Skip to content

Commit

Permalink
bugfixes and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
9072997 committed Jan 2, 2024
1 parent 34d28a0 commit 62fa462
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"os"
"regexp"
"runtime"
"strings"
"sync"
Expand All @@ -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
}

Expand Down Expand Up @@ -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://<redacted>@"))
}
if len(reqBody) > 0 {
logEntry.WriteString(fmt.Sprintf(
Expand Down

0 comments on commit 62fa462

Please sign in to comment.