Skip to content

Commit 5ea4dac

Browse files
committed
[AR-1691] The CLI does not need to know the frontend URL
Currently the CLI has configuration (via `engine.frontend` in a config file or the --frontend flag to a few commands) to control what Engine frontend the user is using. This is primarily set by Apollo employees using staging servers. This is in addition to setting `engine.endpoint` to control which GraphQL server it talks to. This is used for two things: - passing arguments to a couple ServiceMutation fields - printing links in `services:list` As of recently, this no longer is needed: - those ServiceMutation fields now ignore the `frontend` argument and just use the correct frontend for the server processing them - we expose a Query.frontendUrlRoot field that `services:list` can use So this change completely removes recognition of this config field as well as the flag. (Note that it is not an error to have unrecognized fields in your config file, though it is to pass an unknown flag.) While this is technically backwards-incompatible, we don't expect that this undocumented feature is used much other than by Apollo employees.
1 parent be30e14 commit 5ea4dac

13 files changed

Lines changed: 17 additions & 30 deletions

File tree

apollo.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module.exports = {
66
excludes: ["**/*.test.ts", "**/__tests__/*"]
77
},
88
engine: {
9-
frontend: "https://engine-staging.apollographql.com",
109
endpoint: "https://engine-staging-graphql.apollographql.com/api/graphql"
1110
}
1211
};

packages/apollo-language-server/src/config/__tests__/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ describe("ApolloConfig", () => {
7878
const config = new ApolloConfig({});
7979
const overrides = {
8080
engine: {
81-
endpoint: "https://test.apollographql.com/api/graphql",
82-
frontend: "https://test.apollographql.com"
81+
endpoint: "https://test.apollographql.com/api/graphql"
8382
}
8483
};
8584
config.setDefaults(overrides);

packages/apollo-language-server/src/config/__tests__/loadConfig.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ describe("loadConfig", () => {
111111
},
112112
"engine": Object {
113113
"endpoint": "https://engine-graphql.apollographql.com/api/graphql",
114-
"frontend": "https://engine.apollographql.com",
115114
},
116115
}
117116
`);
@@ -136,7 +135,6 @@ describe("loadConfig", () => {
136135
Object {
137136
"engine": Object {
138137
"endpoint": "https://engine-graphql.apollographql.com/api/graphql",
139-
"frontend": "https://engine.apollographql.com",
140138
},
141139
"service": Object {
142140
"endpoint": Object {

packages/apollo-language-server/src/config/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ export interface LocalServiceConfig {
3333

3434
export interface EngineConfig {
3535
endpoint?: EndpointURI;
36-
frontend?: EndpointURI;
3736
readonly apiKey?: string;
3837
}
3938

4039
export const DefaultEngineConfig = {
41-
endpoint: "https://engine-graphql.apollographql.com/api/graphql",
42-
frontend: "https://engine.apollographql.com"
40+
endpoint: "https://engine-graphql.apollographql.com/api/graphql"
4341
};
4442

4543
export const DefaultConfigBase = {

packages/apollo-language-server/src/engine/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class ApolloEngineClient extends GraphQLDataSource {
9898
if (!(data && data.service)) {
9999
throw new Error("Error in request from Apollo Graph Manager");
100100
}
101-
return data.service;
101+
return data;
102102
});
103103
}
104104

packages/apollo-language-server/src/engine/operations/checkPartialSchema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const CHECK_PARTIAL_SCHEMA = gql`
88
$partialSchema: PartialSchemaInput!
99
$gitContext: GitContextInput
1010
$historicParameters: HistoricQueryParameters
11-
$frontend: String
1211
) {
1312
service(id: $id) {
1413
checkPartialSchema(
@@ -17,7 +16,6 @@ export const CHECK_PARTIAL_SCHEMA = gql`
1716
partialSchema: $partialSchema
1817
gitContext: $gitContext
1918
historicParameters: $historicParameters
20-
frontend: $frontend
2119
) {
2220
compositionValidationResult {
2321
compositionValidationDetails {

packages/apollo-language-server/src/engine/operations/checkSchema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const CHECK_SCHEMA = gql`
88
$tag: String
99
$gitContext: GitContextInput
1010
$historicParameters: HistoricQueryParameters
11-
$frontend: String
1211
) {
1312
service(id: $id) {
1413
checkSchema(
@@ -17,7 +16,6 @@ export const CHECK_SCHEMA = gql`
1716
baseSchemaTag: $tag
1817
gitContext: $gitContext
1918
historicParameters: $historicParameters
20-
frontend: $frontend
2119
) {
2220
targetUrl
2321
diffToPrevious {

packages/apollo-language-server/src/engine/operations/listServices.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import gql from "graphql-tag";
22

33
export const LIST_SERVICES = gql`
44
query ListServices($id: ID!, $graphVariant: String!) {
5+
frontendUrlRoot
56
service(id: $id) {
67
implementingServices(graphVariant: $graphVariant) {
78
__typename

packages/apollo-language-server/src/graphqlTypes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ export interface CheckPartialSchemaVariables {
166166
partialSchema: PartialSchemaInput;
167167
gitContext?: GitContextInput | null;
168168
historicParameters?: HistoricQueryParameters | null;
169-
frontend?: string | null;
170169
}
171170

172171
/* tslint:disable */
@@ -296,7 +295,6 @@ export interface CheckSchemaVariables {
296295
tag?: string | null;
297296
gitContext?: GitContextInput | null;
298297
historicParameters?: HistoricQueryParameters | null;
299-
frontend?: string | null;
300298
}
301299

302300
/* tslint:disable */
@@ -355,6 +353,7 @@ export interface ListServices_service {
355353
}
356354

357355
export interface ListServices {
356+
frontendUrlRoot: string;
358357
/**
359358
* Service by ID
360359
*/

packages/apollo/src/Command.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export interface Flags {
3535
localSchemaFile?: string;
3636
key?: string;
3737
engine?: string;
38-
frontend?: string;
3938
tag?: string;
4039
variant?: string;
4140
graph?: string;
@@ -89,10 +88,6 @@ export abstract class ProjectCommand extends Command {
8988
engine: flags.string({
9089
description: "URL for a custom Apollo Graph Manager deployment",
9190
hidden: true
92-
}),
93-
frontend: flags.string({
94-
description: "URL for a custom Apollo Graph Manager frontend",
95-
hidden: true
9691
})
9792
};
9893

@@ -161,8 +156,7 @@ export abstract class ProjectCommand extends Command {
161156
config.setDefaults({
162157
engine: {
163158
apiKey: flags.key,
164-
endpoint: flags.engine,
165-
frontend: flags.frontend
159+
endpoint: flags.engine
166160
}
167161
});
168162

0 commit comments

Comments
 (0)