tools: use os home dir to instead of the hardcoded PATH (#6498)

This commit is contained in:
JayT106
2021-05-31 12:22:55 -04:00
committed by GitHub
parent e3d5a31d6e
commit b4307ca7f4
3 changed files with 14 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
TENDERMINT_VERSION?=latest
BUILD_TAGS?='tendermint'
VERSION := $(shell git describe --always)
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION)
BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION)"
.DEFAULT_GOAL := build

View File

@@ -18,12 +18,13 @@ import (
const (
defaultAcceptRetries = 100
defaultBindAddr = "tcp://127.0.0.1:0"
defaultTMHome = "~/.tendermint"
defaultAcceptDeadline = 1
defaultConnDeadline = 3
defaultExtractKeyOutput = "./signing.key"
)
var defaultTMHome string
var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Command line flags
@@ -60,6 +61,14 @@ Use "tm-signer-harness help <command>" for more information about that command.`
fmt.Println("")
}
hd, err := os.UserHomeDir()
if err != nil {
fmt.Println("The UserHomeDir is not defined, setting the default TM Home PATH to \"~/.tendermint\"")
defaultTMHome = "~/.tendermint"
} else {
defaultTMHome = fmt.Sprintf("%s/.tendermint", hd)
}
runCmd = flag.NewFlagSet("run", flag.ExitOnError)
runCmd.IntVar(&flagAcceptRetries,
"accept-retries",