health: Add CLI flag

This commit is contained in:
crypto-services 2024-02-20 15:56:57 +08:00
parent adc14c80f0
commit 6fc5fbee21
3 changed files with 10 additions and 3 deletions

View file

@ -196,9 +196,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
// Configure log filter RPC API.
filterSystem := utils.RegisterFilterAPI(stack, backend, &cfg.Eth)
// TODO: ENG191 add flag to request endpoint
utils.RegisterHealthService(stack, &cfg.Node)
// Configure the healthcheck API if requested.
if ctx.IsSet(utils.HTTPHealthEnabledFlag.Name) {
utils.RegisterHealthService(stack, &cfg.Node)
}
// Configure GraphQL if requested.
if ctx.IsSet(utils.GraphQLEnabledFlag.Name) {
utils.RegisterGraphQLService(stack, backend, filterSystem, &cfg.Node)

View file

@ -153,6 +153,7 @@ var (
utils.HTTPListenAddrFlag,
utils.HTTPPortFlag,
utils.HTTPCORSDomainFlag,
utils.HTTPHealthEnabledFlag,
utils.AuthListenFlag,
utils.AuthPortFlag,
utils.AuthVirtualHostsFlag,

View file

@ -614,6 +614,11 @@ var (
Value: "",
Category: flags.APICategory,
}
HTTPHealthEnabledFlag = &cli.BoolFlag{
Name: "http.health",
Usage: "Enable the HTTP healthcheck API at path '/health'.",
Category: flags.APICategory,
}
GraphQLEnabledFlag = &cli.BoolFlag{
Name: "graphql",
Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",