mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
7beafa159d
* next compatible, tests pass * terence feedback * skip comment * fixes * misc fix * on block * parse from unencrypted keys json * mod val client * launching unencrypted workssss * fix broken build * fix up build * rem prints * resolve lint * bls comment * fix docker deps * gaz
80 lines
2.6 KiB
Go
80 lines
2.6 KiB
Go
package flags
|
|
|
|
import (
|
|
"os"
|
|
"os/user"
|
|
"path/filepath"
|
|
"runtime"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/cmd"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var (
|
|
// NoCustomConfigFlag determines whether to launch a beacon chain using real parameters or demo parameters.
|
|
NoCustomConfigFlag = cli.BoolFlag{
|
|
Name: "no-custom-config",
|
|
Usage: "Run the beacon chain with the real parameters from phase 0.",
|
|
}
|
|
// BeaconRPCProviderFlag defines a beacon node RPC endpoint.
|
|
BeaconRPCProviderFlag = cli.StringFlag{
|
|
Name: "beacon-rpc-provider",
|
|
Usage: "Beacon node RPC provider endpoint",
|
|
Value: "localhost:4000",
|
|
}
|
|
// CertFlag defines a flag for the node's TLS certificate.
|
|
CertFlag = cli.StringFlag{
|
|
Name: "tls-cert",
|
|
Usage: "Certificate for secure gRPC. Pass this and the tls-key flag in order to use gRPC securely.",
|
|
}
|
|
// KeystorePathFlag defines the location of the keystore directory for a validator's account.
|
|
KeystorePathFlag = cmd.DirectoryFlag{
|
|
Name: "keystore-path",
|
|
Usage: "Path to the desired keystore directory",
|
|
Value: cmd.DirectoryString{Value: defaultValidatorDir()},
|
|
}
|
|
// UnencryptedKeysFlag specifies a file path of a JSON file of unencrypted validator keys as an
|
|
// alternative from launching the validator client from decrypting a keystore directory.
|
|
UnencryptedKeysFlag = cli.StringFlag{
|
|
Name: "unencrypted-keys",
|
|
Usage: "Filepath to a JSON file of unencrypted validator keys for easier launching of the validator client",
|
|
Value: "",
|
|
}
|
|
// PasswordFlag defines the password value for storing and retrieving validator private keys from the keystore.
|
|
PasswordFlag = cli.StringFlag{
|
|
Name: "password",
|
|
Usage: "String value of the password for your validator private keys",
|
|
}
|
|
// DisablePenaltyRewardLogFlag defines the ability to not log reward/penalty information during deployment
|
|
DisablePenaltyRewardLogFlag = cli.BoolFlag{
|
|
Name: "disable-rewards-penalties-logging",
|
|
Usage: "Disable reward/penalty logging during cluster deployment",
|
|
}
|
|
)
|
|
|
|
func homeDir() string {
|
|
if home := os.Getenv("HOME"); home != "" {
|
|
return home
|
|
}
|
|
if usr, err := user.Current(); err == nil {
|
|
return usr.HomeDir
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func defaultValidatorDir() string {
|
|
// Try to place the data folder in the user's home dir
|
|
home := homeDir()
|
|
if home != "" {
|
|
if runtime.GOOS == "darwin" {
|
|
return filepath.Join(home, "Library", "Eth2Validators")
|
|
} else if runtime.GOOS == "windows" {
|
|
return filepath.Join(home, "AppData", "Roaming", "Eth2Validators")
|
|
} else {
|
|
return filepath.Join(home, ".eth2validators")
|
|
}
|
|
}
|
|
// As we cannot guess a stable location, return empty and handle later
|
|
return ""
|
|
}
|