Skip to content

Commit

Permalink
Merge branch 'main' into feat/zmq-server
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad authored Dec 30, 2024
2 parents 3f00fca + c1a13ce commit bfbd86e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package main
import (
"os"
"path/filepath"
"strings"

"github.com/gofrs/flock"
"github.com/pactus-project/pactus/cmd"
"github.com/pactus-project/pactus/util"
"github.com/pactus-project/pactus/wallet"
"github.com/spf13/cobra"
)
Expand All @@ -24,6 +26,9 @@ func buildStartCmd(parentCmd *cobra.Command) {
passwordOpt := startCmd.Flags().StringP("password", "p", "",
"the wallet password")

passwordFromFileOpt := startCmd.Flags().String("password-from-file", "",
"the file containing the wallet password")

startCmd.Run = func(_ *cobra.Command, _ []string) {
workingDir, _ := filepath.Abs(*workingDirOpt)
// change working directory
Expand All @@ -49,8 +54,14 @@ func buildStartCmd(parentCmd *cobra.Command) {
}

var password string

if *passwordOpt != "" {
password = *passwordOpt
} else if *passwordFromFileOpt != "" {
b, err := util.ReadFile(*passwordFromFileOpt)
cmd.FatalErrorCheck(err)

password = strings.TrimSpace(string(b))
} else {
password = cmd.PromptPassword("Wallet password", false)
}
Expand Down

0 comments on commit bfbd86e

Please sign in to comment.