-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
With the advent of TPC and PSC, there’s a lot of complexity with apiEndpoints. To improve, we should:
- expose an
async Storage#getEndpoint()method - make the
apiEndpointproperty private - remove the
useAuthWithCustomEndpointparameter/property - remove the internal
customEndpointparameter/property
Additionally, if STORAGE_EMULATOR_HOST is detected and used the PassThrough AuthClient should be used by default (which can be overwritten via the existing authClient parameter) - removing the need for the useAuthWithCustomEndpoint parameter.
This will greatly clean-up the code base as:
- Customers will not be required to manually provide the
universeDomain- as we can determine it asynchronously viaGoogleAuth#getUniverseDomain. This is a major convenience for TPC customers. - We can offer a predictable, secure experience by not disabling auth by default when an
apiEndpointhas been provided - Classes will no longer have to distinguish between auth and non-auth contexts - we can simply use
autheverywhere uniformly
Related:
- refactor!: Revamp
apiEndpointnodejs-storage#2400 - feat!: Align Support for Storage Emulation nodejs-storage#2092
- feat:
PassThroughAuthClient google-auth-library-nodejs#1771
We this change we can remove the following:
Lines 140 to 148 in 0b4380a
| /** | |
| * If true, just return the provided request options. Default: false. | |
| */ | |
| customEndpoint?: boolean; | |
| /** | |
| * If true, will authenticate when using a custom endpoint. Default: false. | |
| */ | |
| useAuthWithCustomEndpoint?: boolean; |
Lines 766 to 777 in 0b4380a
| const authorizeRequest = async () => { | |
| if ( | |
| reqConfig.customEndpoint && | |
| !reqConfig.useAuthWithCustomEndpoint | |
| ) { | |
| // Using a custom API override. Do not use `google-auth-library` for | |
| // authentication. (ex: connecting to a local Datastore server) | |
| return reqOpts; | |
| } else { | |
| return authClient.authorizeRequest(reqOpts); | |
| } | |
| }; |
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.