mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 00:27:38 +00:00
Enable JSON-HTTP Gateway by Default on Port 3000 (#6090)
* default port 3000 http gateway * Merge refs/heads/master into default-gateway * Merge refs/heads/master into default-gateway * fix broken node test * disable grpc gateway * Merge refs/heads/master into default-gateway * Merge refs/heads/master into default-gateway
This commit is contained in:
parent
75aaa5e07b
commit
80539d9028
@ -60,10 +60,16 @@ var (
|
||||
Name: "tls-key",
|
||||
Usage: "Key for secure gRPC. Pass this and the tls-cert flag in order to use gRPC securely.",
|
||||
}
|
||||
// DisableGRPCGateway for JSON-HTTP requests to the beacon node.
|
||||
DisableGRPCGateway = &cli.BoolFlag{
|
||||
Name: "disable-grpc-gateway",
|
||||
Usage: "Disable the gRPC gateway for JSON-HTTP requests",
|
||||
}
|
||||
// GRPCGatewayPort enables a gRPC gateway to be exposed for Prysm.
|
||||
GRPCGatewayPort = &cli.IntFlag{
|
||||
Name: "grpc-gateway-port",
|
||||
Usage: "Enable gRPC gateway for JSON requests",
|
||||
Value: 3000,
|
||||
}
|
||||
// GPRCGatewayCorsDomain serves preflight requests when serving gRPC JSON gateway.
|
||||
GPRCGatewayCorsDomain = &cli.StringFlag{
|
||||
|
@ -41,7 +41,7 @@ func (g *Gateway) Start() {
|
||||
ctx, cancel := context.WithCancel(g.ctx)
|
||||
g.cancel = cancel
|
||||
|
||||
log.WithField("address", g.gatewayAddr).Info("Starting gRPC gateway.")
|
||||
log.WithField("address", g.gatewayAddr).Info("Starting JSON-HTTP API")
|
||||
|
||||
conn, err := g.dial(ctx, "tcp", g.remoteAddr)
|
||||
if err != nil {
|
||||
@ -106,9 +106,11 @@ func (g *Gateway) Status() error {
|
||||
|
||||
// Stop the gateway with a graceful shutdown.
|
||||
func (g *Gateway) Stop() error {
|
||||
if g.server != nil {
|
||||
if err := g.server.Shutdown(g.ctx); err != nil {
|
||||
log.WithError(err).Error("Failed to shut down server")
|
||||
}
|
||||
}
|
||||
|
||||
if g.cancel != nil {
|
||||
g.cancel()
|
||||
|
@ -32,6 +32,7 @@ var appFlags = []cli.Flag{
|
||||
flags.RPCPort,
|
||||
flags.CertFlag,
|
||||
flags.KeyFlag,
|
||||
flags.DisableGRPCGateway,
|
||||
flags.GRPCGatewayPort,
|
||||
flags.MinSyncPeers,
|
||||
flags.RPCMaxPageSize,
|
||||
|
@ -591,8 +591,10 @@ func (b *BeaconNode) registerPrometheusService() error {
|
||||
}
|
||||
|
||||
func (b *BeaconNode) registerGRPCGateway() error {
|
||||
if b.cliCtx.Bool(flags.DisableGRPCGateway.Name) {
|
||||
return nil
|
||||
}
|
||||
gatewayPort := b.cliCtx.Int(flags.GRPCGatewayPort.Name)
|
||||
if gatewayPort > 0 {
|
||||
selfAddress := fmt.Sprintf("127.0.0.1:%d", b.cliCtx.Int(flags.RPCPort.Name))
|
||||
gatewayAddress := fmt.Sprintf("0.0.0.0:%d", gatewayPort)
|
||||
allowedOrigins := strings.Split(b.cliCtx.String(flags.GPRCGatewayCorsDomain.Name), ",")
|
||||
@ -609,8 +611,6 @@ func (b *BeaconNode) registerGRPCGateway() error {
|
||||
),
|
||||
)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *BeaconNode) registerInteropServices() error {
|
||||
genesisTime := b.cliCtx.Uint64(flags.InteropGenesisTimeFlag.Name)
|
||||
|
@ -89,6 +89,7 @@ var appHelpFlagGroups = []flagGroup{
|
||||
flags.RPCMaxPageSize,
|
||||
flags.CertFlag,
|
||||
flags.KeyFlag,
|
||||
flags.DisableGRPCGateway,
|
||||
flags.GRPCGatewayPort,
|
||||
flags.HTTPWeb3ProviderFlag,
|
||||
flags.SetGCPercent,
|
||||
|
Loading…
Reference in New Issue
Block a user