Skip to content

Commit

Permalink
Merge pull request #581 from SiaFoundation/nate/fix-log-migration
Browse files Browse the repository at this point in the history
Correctly migrate log directory
  • Loading branch information
n8maninger authored Jan 21, 2025
2 parents 5d510f5 + e3a1308 commit be43369
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
default: patch
---

# Fixed an inconsistency migrating the config's log directory from the v1.1.2 config file

The deprecated `Log.Path` config field was a directory, while the new `Log.File.Path` is expected to be a file path. If the log directory was set, the log file path will be correctly migrated to `hostd.log` in the directory.
5 changes: 3 additions & 2 deletions config/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"

"gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -146,8 +147,8 @@ func updateConfigV112(fp string, r io.Reader, cfg *Config) error {
cfg.Log.Level = old.Log.Level
if old.Log.File.Path != "" {
cfg.Log.File.Path = old.Log.File.Path
} else {
cfg.Log.File.Path = old.Log.Path
} else if old.Log.Path != "" {
cfg.Log.File.Path = filepath.Join(old.Log.Path, "hostd.log")
}
cfg.Log.StdOut.Level = old.Log.StdOut.Level
cfg.Log.StdOut.Enabled = old.Log.StdOut.Enabled
Expand Down

0 comments on commit be43369

Please sign in to comment.