Skip to content

Commit

Permalink
cmd: fix directory not exist error
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jan 19, 2024
1 parent ddfdc9b commit 93e3095
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/hostd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ func main() {
setSeedPhrase()
}

// create the data directory if it does not already exist
if err := os.MkdirAll(cfg.Directory, 0700); err != nil {
stdoutFatalError("unable to create config directory: " + err.Error())
}

// configure the logger
if !cfg.Log.StdOut.Enabled && !cfg.Log.File.Enabled {
stdoutFatalError("At least one of stdout or file logging must be enabled")
Expand Down Expand Up @@ -333,11 +338,6 @@ func main() {
}
walletKey := wallet.KeyFromSeed(&seed, 0)

// create the data directory if it does not already exist
if err := os.MkdirAll(cfg.Directory, 0700); err != nil {
log.Fatal("unable to create config directory", zap.Error(err))
}

apiListener, err := startAPIListener(log)
if err != nil {
log.Fatal("failed to listen on API address", zap.Error(err), zap.String("address", cfg.HTTP.Address))
Expand Down

0 comments on commit 93e3095

Please sign in to comment.