mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 05:18:03 -05:00
moving web flag to feature (#15382)
This commit is contained in:
@@ -437,7 +437,7 @@ func (c *ValidatorClient) registerValidatorService(cliCtx *cli.Context) error {
|
||||
Web3SignerConfig: web3signerConfig,
|
||||
ProposerSettings: ps,
|
||||
ValidatorsRegBatchSize: cliCtx.Int(flags.ValidatorsRegistrationBatchSizeFlag.Name),
|
||||
EnableAPI: cliCtx.Bool(flags.EnableWebFlag.Name) || cliCtx.Bool(flags.EnableRPCFlag.Name),
|
||||
EnableAPI: features.Get().EnableWeb || cliCtx.Bool(flags.EnableRPCFlag.Name),
|
||||
LogValidatorPerformance: !cliCtx.Bool(flags.DisablePenaltyRewardLogFlag.Name),
|
||||
EmitAccountMetrics: !cliCtx.Bool(flags.DisableAccountMetricsFlag.Name),
|
||||
Distributed: cliCtx.Bool(flags.EnableDistributed.Name),
|
||||
@@ -501,7 +501,7 @@ func proposerSettings(cliCtx *cli.Context, db iface.ValidatorDB) (*proposer.Sett
|
||||
}
|
||||
|
||||
func (c *ValidatorClient) registerRPCService(cliCtx *cli.Context) error {
|
||||
serveWebUI := cliCtx.IsSet(flags.EnableWebFlag.Name)
|
||||
serveWebUI := features.Get().EnableWeb
|
||||
if !cliCtx.IsSet(flags.EnableRPCFlag.Name) && !serveWebUI {
|
||||
return nil
|
||||
}
|
||||
@@ -557,7 +557,6 @@ func (c *ValidatorClient) registerRPCService(cliCtx *cli.Context) error {
|
||||
AuthTokenPath: authTokenPath,
|
||||
Middlewares: middlewares,
|
||||
Router: http.NewServeMux(),
|
||||
ServeWebUI: serveWebUI,
|
||||
})
|
||||
return c.services.RegisterService(s)
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/api"
|
||||
"github.com/OffchainLabs/prysm/v6/config/features"
|
||||
"github.com/OffchainLabs/prysm/v6/encoding/bytesutil"
|
||||
"github.com/OffchainLabs/prysm/v6/io/file"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
@@ -32,7 +33,7 @@ func CreateAuthToken(authPath, validatorWebAddr string) error {
|
||||
if err := saveAuthToken(authPath, token); err != nil {
|
||||
return err
|
||||
}
|
||||
logValidatorWebAuth(true, validatorWebAddr, token, authPath)
|
||||
logValidatorWebAuth(validatorWebAddr, token, authPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ func (s *Server) refreshAuthTokenFromFileChanges(ctx context.Context, authTokenP
|
||||
continue
|
||||
}
|
||||
validatorWebAddr := fmt.Sprintf("%s:%d", s.httpHost, s.httpPort)
|
||||
logValidatorWebAuth(s.serveWebUI, validatorWebAddr, s.authToken, authTokenPath)
|
||||
logValidatorWebAuth(validatorWebAddr, s.authToken, authTokenPath)
|
||||
case err := <-watcher.Errors:
|
||||
log.WithError(err).Errorf("Could not watch for file changes for: %s", authTokenPath)
|
||||
case <-ctx.Done():
|
||||
@@ -114,8 +115,8 @@ func (s *Server) refreshAuthTokenFromFileChanges(ctx context.Context, authTokenP
|
||||
}
|
||||
}
|
||||
|
||||
func logValidatorWebAuth(useWeb bool, validatorWebAddr, token, tokenPath string) {
|
||||
if useWeb {
|
||||
func logValidatorWebAuth(validatorWebAddr, token, tokenPath string) {
|
||||
if features.Get().EnableWeb {
|
||||
webAuthURLTemplate := "http://%s/initialize?token=%s"
|
||||
webAuthURL := fmt.Sprintf(
|
||||
webAuthURLTemplate,
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/OffchainLabs/prysm/v6/api/server/httprest"
|
||||
"github.com/OffchainLabs/prysm/v6/api/server/middleware"
|
||||
"github.com/OffchainLabs/prysm/v6/async/event"
|
||||
"github.com/OffchainLabs/prysm/v6/config/features"
|
||||
"github.com/OffchainLabs/prysm/v6/io/logs"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/validator/accounts/wallet"
|
||||
@@ -43,12 +44,10 @@ type Config struct {
|
||||
AuthTokenPath string
|
||||
Middlewares []middleware.Middleware
|
||||
Router *http.ServeMux
|
||||
ServeWebUI bool
|
||||
}
|
||||
|
||||
// Server defining a HTTP server for the remote signer API and registering clients
|
||||
type Server struct {
|
||||
serveWebUI bool
|
||||
walletInitialized bool
|
||||
logStreamerBufferSize int
|
||||
grpcMaxCallRecvMsgSize int
|
||||
@@ -106,7 +105,6 @@ func NewServer(ctx context.Context, cfg *Config) *Server {
|
||||
beaconApiEndpoint: cfg.BeaconApiEndpoint,
|
||||
beaconNodeEndpoint: cfg.BeaconNodeGRPCEndpoint,
|
||||
router: cfg.Router,
|
||||
serveWebUI: cfg.ServeWebUI,
|
||||
}
|
||||
|
||||
if server.authTokenPath == "" && server.walletDir != "" {
|
||||
@@ -119,7 +117,7 @@ func NewServer(ctx context.Context, cfg *Config) *Server {
|
||||
log.WithError(err).Error("Could not initialize web auth token")
|
||||
}
|
||||
validatorWebAddr := fmt.Sprintf("%s:%d", server.httpHost, server.httpPort)
|
||||
logValidatorWebAuth(server.serveWebUI, validatorWebAddr, server.authToken, server.authTokenPath)
|
||||
logValidatorWebAuth(validatorWebAddr, server.authToken, server.authTokenPath)
|
||||
go server.refreshAuthTokenFromFileChanges(server.ctx, server.authTokenPath)
|
||||
}
|
||||
|
||||
@@ -166,7 +164,7 @@ func (s *Server) InitializeRoutesWithWebHandler() error {
|
||||
s.router.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
if s.serveWebUI {
|
||||
if features.Get().EnableWeb {
|
||||
web.Handler(w, r)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user