googleapis / googleapis/google-cloud-node

refactor!: Revamp `apiEndpoint`

Đang mở
#7,828 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: common priority: p2 type: feature request
Ngôn ngữ chính
TypeScript
Star
3.2k
Fork
712
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
104

Mô tả

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 `apiEndpoint` property private
- remove the `useAuthWithCustomEndpoint` parameter/property
- remove the internal `customEndpoint` parameter/property

Additionally, if `STORAGE_EMULATOR_HOST` is detected and used the [`PassThrough`](https://github.com/googleapis/google-auth-library-nodejs/blob/b070ffbfeb35a7f4552e86bf1840645096951b58/src/auth/passthrough.ts#L19-L26) `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 via `GoogleAuth#getUniverseDomain`. This is a **major** convenience for TPC customers.
- We can offer a predictable, secure experience by not disabling auth by default when an `apiEndpoint` has been provided
- Classes will no longer have to distinguish between auth and non-auth contexts - we can simply use `auth` everywhere uniformly

Related:
- https://github.com/googleapis/nodejs-storage/issues/2400
- https://github.com/googleapis/nodejs-storage/issues/2092
- https://github.com/googleapis/google-auth-library-nodejs/pull/1771

We this change we can remove the following:

https://github.com/googleapis/nodejs-common/blob/0b4380af5e347ef0855d1e0ad45e055a2a9c6120/src/util.ts#L140-L148

https://github.com/googleapis/nodejs-common/blob/0b4380af5e347ef0855d1e0ad45e055a2a9c6120/src/util.ts#L766-L777

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách lần theo Storage API và các tham số và thuộc tính apiEndpoint, useAuthWithCustomEndpoint và customEndpoint của nó. Đọc các phạm vi được liên kết trong nodejs-common src/util.ts cùng với các issue liên quan đến storage và pull request của auth-library để có thêm ngữ cảnh. Công việc được xem là hoàn tất khi getEndpoint() được exposed, apiEndpoint là private, các tham số lỗi thời được loại bỏ và auth của emulator mặc định là PassThrough, trong khi authClient vẫn có thể được override.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
gcp, nodejs, typescript
Lĩnh vực
api, backend, cloud
Loại issue
Tái cấu trúc
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.