Skip to content

Commit

Permalink
Respect --endpoint and --headers flags for client:* commands
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Nov 9, 2018
1 parent 384172b commit 5ed6153
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/apollo/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,21 @@ export abstract class ClientCommand extends ProjectCommand {
constructor(argv, config) {
super(argv, config);
this.type = "client";
this.configMap = (flags: any) => ({
client: {
name: flags.clientName,
referenceID: flags.clientReferenceId,
version: flags.clientVersion
this.configMap = (flags: any) => {
const config = {
client: {
name: flags.clientName,
referenceID: flags.clientReferenceId,
version: flags.clientVersion
}
} as WithRequired<DeepPartial<ApolloConfig>, "client">;
if (flags.endpoint) {
config.client.service = {
url: flags.endpoint,
headers: flags.headers
};
}
});
return config;
};
}
}

0 comments on commit 5ed6153

Please sign in to comment.