mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-04-19 03:01:06 -04:00
consistent auth token for validator apis (#13747)
* wip * fixing tests * adding more tests especially to handle legacy * fixing linting * fixing deepsource issues and flags * fixing some deepsource issues,pathing issues, and logs * some review items * adding additional review feedback * updating to follow updates from https://github.com/ethereum/keymanager-APIs/pull/74 * adjusting functions to match changes in keymanagers PR * Update validator/rpc/auth_token.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/auth_token.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/auth_token.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * review feedback --------- Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -639,6 +639,17 @@ func (c *ValidatorClient) registerRPCService(router *mux.Router) error {
|
||||
walletDir := c.cliCtx.String(flags.WalletDirFlag.Name)
|
||||
grpcHeaders := c.cliCtx.String(flags.GrpcHeadersFlag.Name)
|
||||
clientCert := c.cliCtx.String(flags.CertFlag.Name)
|
||||
|
||||
authTokenPath := c.cliCtx.String(flags.AuthTokenPathFlag.Name)
|
||||
// if no auth token path flag was passed try to set a default value
|
||||
if authTokenPath == "" {
|
||||
authTokenPath = flags.AuthTokenPathFlag.Value
|
||||
// if a wallet dir is passed without an auth token then override the default with the wallet dir
|
||||
if walletDir != "" {
|
||||
authTokenPath = filepath.Join(walletDir, api.AuthTokenFileName)
|
||||
}
|
||||
}
|
||||
|
||||
server := rpc.NewServer(c.cliCtx.Context, &rpc.Config{
|
||||
ValDB: c.db,
|
||||
Host: rpcHost,
|
||||
@@ -648,6 +659,7 @@ func (c *ValidatorClient) registerRPCService(router *mux.Router) error {
|
||||
SyncChecker: vs,
|
||||
GenesisFetcher: vs,
|
||||
NodeGatewayEndpoint: nodeGatewayEndpoint,
|
||||
AuthTokenPath: authTokenPath,
|
||||
WalletDir: walletDir,
|
||||
Wallet: c.wallet,
|
||||
ValidatorGatewayHost: validatorGatewayHost,
|
||||
|
||||
Reference in New Issue
Block a user