Skip to content
This repository was archived by the owner on Jul 13, 2025. It is now read-only.
This repository was archived by the owner on Jul 13, 2025. It is now read-only.

[nodejs] Add support for apiEndpoint override #2787

Closed

Description

@JustinBeckwith

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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

lang: nodejsIssues specific to JavaScript or TypeScript.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions