Router Configuration
Configure a router via environment variables, command-line options, and YAML
Learn how to customize the behavior of your GraphOS Router or Apollo Router Core with environment variables, command-line commands and options, and YAML file configuration.
Environment variables
If you're using the GraphOS Router with managed federation and GraphOS Studio, set these environment variables in the startup command:
1APOLLO_KEY="..." APOLLO_GRAPH_REF="..." ./router
Environment Variable | Description |
---|---|
| The graph ref for the GraphOS graph and variant that the router fetches its supergraph schema from (e.g., docs-example-graph@staging ).Required when using managed federation, except when using an offline license to run the router. |
| The graph API key that the router should use to authenticate with GraphOS when fetching its supergraph schema.Required when using managed federation, except when using an offline license to run the router or when using APOLLO_KEY_PATH . |
| ⚠️ This is not available on Windows.A path to a file containing the graph API key that the router should use to authenticate with GraphOS when fetching its supergraph schema.Required when using managed federation, except when using an offline license to run the router or when using APOLLO_KEY . |
Command-line options
After installing the Apollo Router Core in your current working directory, you can run the router with the following example command:
1./router --config router.yaml --supergraph supergraph-schema.graphql
This reference lists and describes the options supported by the router
binary. Where indicated, some of these options can also be provided via an environment variable. If an option is provided both ways, the command-line value takes precedence.
Option / Environment Variable | Description |
---|---|
| The supergraph schema of a router. Specified by absolute or relative path (-s / --supergraph <supergraph_path> , or APOLLO_ROUTER_SUPERGRAPH_PATH ), or a comma-separated list of URLs (APOLLO_ROUTER_SUPERGRAPH_URLS ).💡 Avoid embedding tokens in Setting this option disables polling from Apollo Uplink to fetch the latest supergraph schema.To learn how to compose your supergraph schema with the Rover CLI, see the Federation quickstart.Required if you are not using managed federation. If you are using managed federation, you may need to set this option when following advanced deployment workflows. |