Hive Gateway CLI Reference
An overview of all the CLI arguments and environment variables for the hive-gateway CLI.
Get started with the CLI.
Usage
You can get help with using the CLI by appending the --help argument:
hive-gateway --helpwhich will print out the following:
Usage: hive-gateway [options] [command]
Unify and accelerate your data graph across diverse services with Hive Gateway, which seamlessly
integrates with Apollo Federation.
Options:
  --fork <number>                                 number of workers to spawn. (default: 1) (env:
                                                  FORK)
  -c, --config-path <path>                        path to the configuration file. defaults to
                                                  the following files respectively in the
                                                  current working directory: gateway.ts,
                                                  gateway.mts, gateway.cts, gateway.js,
                                                  gateway.mjs, gateway.cjs (env: CONFIG_PATH)
  -h, --host <hostname>                           host to use for serving (default: 0.0.0.0)
  -p, --port <number>                             port to use for serving (default: 4000) (env:
                                                  PORT)
  --polling <duration>                            schema polling interval in human readable
                                                  duration (default: 10s) (env: POLLING)
  --no-masked-errors                              don't mask unexpected errors in responses
  --masked-errors                                 mask unexpected errors in responses (default:
                                                  true)
  --opentelemetry [exporter-endpoint]             Enable OpenTelemetry integration with an
                                                  exporter using this option's value as
                                                  endpoint. By default, it uses OTLP HTTP, use
                                                  "--opentelemetry-exporter-type" to change the
                                                  default. (env: OPENTELEMETRY)
  --opentelemetry-exporter-type <type>            OpenTelemetry exporter type to use when
                                                  setting up OpenTelemetry integration. Requires
                                                  "--opentelemetry" to set the endpoint.
                                                  (choices: "otlp-http", "otlp-grpc", default:
                                                  "otlp-http", env: OPENTELEMETRY_EXPORTER_TYPE)
  --hive-registry-token <token>                   [DEPRECATED] please use "--hive-target" and
                                                  "--hive-access-token" (env:
                                                  HIVE_REGISTRY_TOKEN)
  --hive-usage-target <target>                    [DEPRECATED] please use --hive-target instead.
                                                  (env: HIVE_USAGE_TARGET)
  --hive-target <target>                          Hive registry target to which the usage and
                                                  tracing data should be reported to. Requires
                                                  either "--hive-access-token <token>",
                                                  "--hive-usage-access-token <token>" or
                                                  "--hive-trace-access-token" option (env:
                                                  HIVE_TARGET)
  --hive-access-token <token>                     Hive registry access token for usage metrics
                                                  reporting and tracing. Enables both usage
                                                  reporting and tracing. Requires the
                                                  "--hive-target <target>" option (env:
                                                  HIVE_ACCESS_TOKEN)
  --hive-usage-access-token <token>               Hive registry access token for usage
                                                  reporting. Enables Hive usage report. Requires
                                                  the "--hive-target <target>" option. It can't
                                                  be used together with "--hive-access-token"
                                                  (env: HIVE_USAGE_ACCESS_TOKEN)
  --hive-trace-access-token <token>               Hive registry access token for tracing.
                                                  Enables Hive tracing. Requires the
                                                  "--hive-target <target>" option. It can't be
                                                  used together with "--hive-access-token" (env:
                                                  HIVE_TRACE_ACCESS_TOKEN)
  --hive-trace-endpoint <endpoint>                Hive registry tracing endpoint. (default:
                                                  "https://api.graphql-hive.com/otel/v1/traces",
                                                  env: HIVE_TRACE_ENDPOINT)
  --hive-persisted-documents-endpoint <endpoint>  [EXPERIMENTAL] Hive CDN endpoint for fetching
                                                  the persisted documents. Requires the
                                                  "--hive-persisted-documents-token <token>"
                                                  option
  --hive-persisted-documents-token <token>        [EXPERIMENTAL] Hive persisted documents CDN
                                                  endpoint token. Requires the
                                                  "--hive-persisted-documents-endpoint
                                                  <endpoint>" option
  --hive-cdn-endpoint <endpoint>                  Hive CDN endpoint for fetching the schema
                                                  (env: HIVE_CDN_ENDPOINT)
  --hive-cdn-key <key>                            Hive CDN API key for fetching the schema.
                                                  implies that the "schemaPathOrUrl" argument is
                                                  a url (env: HIVE_CDN_KEY)
  --apollo-graph-ref <graphRef>                   Apollo graph ref of the managed federation
                                                  graph (<YOUR_GRAPH_ID>@<VARIANT>) (env:
                                                  APOLLO_GRAPH_REF)
  --apollo-key <apiKey>                           Apollo API key to use to authenticate with the
                                                  managed federation up link (env: APOLLO_KEY)
  --disable-websockets                            Disable WebSockets support
  --jit                                           Enable Just-In-Time compilation of GraphQL
                                                  documents (env: JIT) (env: JIT)
  -V, --version                                   output the version number
  --help                                          display help for command
Commands:
  supergraph [options] [schemaPathOrUrl]          serve a Federation supergraph provided by a
                                                  compliant composition tool such as Mesh
                                                  Compose or Apollo Rover
  subgraph [schemaPathOrUrl]                      serve a Federation subgraph that can be used
                                                  with any Federation compatible router like
                                                  Apollo Router/Gateway
  proxy [options] [endpoint]                      serve a proxy to a GraphQL API and add
                                                  additional features such as
                                                  monitoring/tracing, caching, rate limiting,
                                                  security, and more
  help [command]                                  display help for commandAll arguments can also be configured in the config file.
Environment Variables
In addition to the env vars showcased in the CLI usage, more are available.
These are usually used for easier usage with these two schema registry services. You don’t need any configuration file if you provide these environment variables.
Hive Registry
- HIVE_CDN_ENDPOINT: The endpoint of the Hive Registry CDN
- HIVE_CDN_KEY: The API key provided by Hive Registry to fetch the schema
- HIVE_TARGET: The target for usage reporting and observability in Hive Console
- HIVE_USAGE_TARGET(deprecated, use- HIVE_TARGET): The target for usage reporting and observability in Hive Console
- HIVE_ACCESS_TOKEN: The access token used for usage reporting and observability in Hive Console
- HIVE_USAGE_ACCESS_TOKEN: The access token used for usage reporting only in Hive Console
- HIVE_TRACE_ACCESS_TOKEN: The access token used for observability only in Hive Console
Learn more about Hive Registry integration here
Apollo GraphOS
- APOLLO_KEY: The API key provided by Apollo GraphOS to fetch the supergraph.
- APOLLO_GRAPH_REF: The API key provided by Apollo GraphOS to fetch the supergraph.
- APOLLO_SCHEMA_CONFIG_DELIVERY_ENDPOINT: The URL of the managed federation up link. By default, it uses the first uplink in the list.
Last updated on