Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

[nodejs] Add support for apiEndpoint override #2787

Closed
JustinBeckwith opened this issue May 23, 2019 · 0 comments · Fixed by #2800
Closed

[nodejs] Add support for apiEndpoint override #2787

JustinBeckwith opened this issue May 23, 2019 · 0 comments · Fixed by #2800
Assignees
Labels
lang: nodejs Issues specific to JavaScript or TypeScript.

Comments

@JustinBeckwith
Copy link
Contributor

Today, we allow developers to override the service endpoint using the servicePath variable in the service client constructor:

const client = new ImageAnnotatorClient({
  servicePath: 'vision.not-googleapis.com'
});

In go/extensible-options-in-nodejs, we discuss changing this to apiEndpoint, as it's consistent with existing hand written libs, and feel that it's a little more obvious:

const client = new ImageAnnotatorClient({
  apiEndpoint: 'vision.not-googleapis.com'
});

Ideally, this wouldn't be a breaking change. In the generated code, it should look something like this:

const servicePath = 
  opts.servicePath || 
  opts.apiEndpoint || 
  this.constructor.servicePath;

opts = Object.assign({
  clientConfig: {},
  port: this.constructor.port
}, opts);

If we're feeling 🌶 , we could also add the apiEndpoint getter to match the contents of servicePath.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang: nodejs Issues specific to JavaScript or TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants