mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
9d375969d1
* Use log.WithError static analysis from #11143 and fix all violations * Fix another log violation after pulling from develop * Update beacon-chain/sync/pending_blocks_queue.go Co-authored-by: Potuz <potuz@prysmaticlabs.com> * @potuz feedback * Copy paste fail * fix tests Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Potuz <potuz@prysmaticlabs.com>
54 lines
1.6 KiB
Go
54 lines
1.6 KiB
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/prysmaticlabs/prysm/cmd"
|
|
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
|
|
"github.com/prysmaticlabs/prysm/config/features"
|
|
"github.com/prysmaticlabs/prysm/runtime/tos"
|
|
"github.com/prysmaticlabs/prysm/validator/rpc"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Commands for managing Prysm validator accounts.
|
|
var Commands = &cli.Command{
|
|
Name: "web",
|
|
Category: "web",
|
|
Usage: "defines commands for interacting with the Prysm web interface",
|
|
Subcommands: []*cli.Command{
|
|
{
|
|
Name: "generate-auth-token",
|
|
Description: `Generate an authentication token for the Prysm web interface`,
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
flags.WalletDirFlag,
|
|
flags.GRPCGatewayHost,
|
|
flags.GRPCGatewayPort,
|
|
cmd.AcceptTosFlag,
|
|
}),
|
|
Before: func(cliCtx *cli.Context) error {
|
|
if err := cmd.LoadFlagsFromConfig(cliCtx, cliCtx.Command.Flags); err != nil {
|
|
return err
|
|
}
|
|
return tos.VerifyTosAcceptedOrPrompt(cliCtx)
|
|
},
|
|
Action: func(cliCtx *cli.Context) error {
|
|
if err := features.ConfigureValidator(cliCtx); err != nil {
|
|
return err
|
|
}
|
|
walletDirPath := cliCtx.String(flags.WalletDirFlag.Name)
|
|
if walletDirPath == "" {
|
|
log.Fatal("--wallet-dir not specified")
|
|
}
|
|
gatewayHost := cliCtx.String(flags.GRPCGatewayHost.Name)
|
|
gatewayPort := cliCtx.Int(flags.GRPCGatewayPort.Name)
|
|
validatorWebAddr := fmt.Sprintf("%s:%d", gatewayHost, gatewayPort)
|
|
if err := rpc.CreateAuthToken(walletDirPath, validatorWebAddr); err != nil {
|
|
log.WithError(err).Fatal("Could not create web auth token")
|
|
}
|
|
return nil
|
|
},
|
|
},
|
|
},
|
|
}
|