-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move basic configuration from engine to apollo
Currently, the `engine` option to `new ApolloServer` contains a mishmash of data including the Apollo API key, the graph variant, configuration options for usage reporting, configuration options for schema reporting, and more. Also, Engine is no longer the name of the Apollo commercial product (the web app is now called Studio). This is the first PR in a series of PRs which will replace this `engine` option. Future PRs will refactor `EngineReportingAgent` into a set of smaller `ApolloServerPlugin`s. This PR addresses the basic configuration: API key, graph ID, and graph variant. It adds a new option called `apollo` to `new ApolloServer` of type `ApolloConfigInput`, where you can specify the API key, graph ID, and graph variant. It adds a second type `ApolloConfig`, which is similar except it also contains the API key hash, and the graph variant here is always defined ('current' by default). A single new internal determineApolloConfig function is used to produce an `ApolloConfig` object at the top of the ApolloServer constructor, consolidating a bunch of previously scattered code. (This also consolidates some warnings. For example, we now consistently warn when you create an ApolloServer and an API key is available but a variant is not specified, instead of doing that in just ApolloGateway.) It is an error to pass both `apollo` and `engine` to `new ApolloServer`. This does mean that if you want to configure any of the other aspects of reporting, you can not yet use the `apollo` option. I do not expect this PR to be released until all of that configuration can be done via separate plugins as mentioned above. This `ApolloConfig` object is now passed to `ApolloServerPlugin`s in `serverWillStart`, to `ApolloGateway` in `load`, and to the `EngineReportingAgent` constructor. The former two still also receive `engine` options for backwards compatibility. `ApolloGateway` will be updated to be able to read both `apollo` and `engine` in apollographql/federation#148 (Note that I've intentionally applied `prettier` to apollo-engine-reporting's agent.ts, as that package's files have generally been kept prettier-clean. That file will be deleted soon anyway.)
- Loading branch information
Showing
14 changed files
with
323 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.