Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: simplify rpc endpoint setting (#9054)

Tianzhou (天舟)0f6a4a15c55d
diff --git a/frontend/.env.dev-local b/frontend/.env.dev-local
index 29bd35bd71..737f60a088 100644
--- a/frontend/.env.dev-local
+++ b/frontend/.env.dev-local
@@ -1,4 +1,4 @@
NODE_ENV=development
BB_DEV_TEAM_LICENSE=eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTk5LCJ0cmlhbGluZyI6ZmFsc2UsInBsYW4iOiJURUFNIiwiYXVkIjoiYmIubGljZW5zZSIsImV4cCI6MzMxNjkzOTIwMDAsImlhdCI6MTY0MzQ2Mzg4MiwiaXNzIjoiYnl0ZWJhc2UiLCJzdWIiOiI2NzUxODU0NS45MTI4NjI4NSJ9.plmS-PNPsI-Esis1ZCLWYgbx7K3C1AlQKG7pY1w_stuxOZgpSK3wm-GC4ILg8e6HebqAhz_39X2f9DvvOFySbnPffJ9v3Q3bTwxgk9vR1ttorS9VTWlZNv2tRmKeQD1rZCIS3gRV8pLX4WEClkn41Bv4DFnmQfcEXeBnw_DivE_yMFgrAmxFeyJVZfP0NslXBBRcwiZ_nObntF_65k6Hr4uPXFR5L99XCCqg5Fu-R0lj7tCbheHBQyXbDujBYqrltbVsrN5ov8Mc7gqbgV9KTCEfAzLsgygO2epkuQkMYdXxRz_oWDLED0WwCZ7-EMz3EqLngZjr6e_hHcapt6SSNQ
BB_DEV_ENTERPRISE_LICENSE=eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTksInRyaWFsaW5nIjpmYWxzZSwicGxhbiI6IkVOVEVSUFJJU0UiLCJvcmdOYW1lIjoiYmIiLCJhdWQiOiJiYi5saWNlbnNlIiwiZXhwIjo3OTc0OTc5MjAwLCJpYXQiOjE2NjM2Njc1NjEsImlzcyI6ImJ5dGViYXNlIiwic3ViIjoiMDAwMDEwMDAuIn0.JjYCMeAAMB9FlVeDFLdN3jvFcqtPsbEzaIm1YEDhUrfekthCbIOeX_DB2Bg2OUji3HSX5uDvG9AkK4Gtrc4gLMPI3D5mk3L-6wUKZ0L4REztS47LT4oxVhpqPQayYa9lKJB1YoHaqeMV4Z5FXeOXwuACoELznlwpT6pXo9xXm_I6QwQiO7-zD83XOTO4PRjByc-q3GKQu_64zJMIKiCW0I8a3GvrdSnO7jUuYU1KPmCuk0ZRq3I91m29LTo478BMST59HqCLj1GGuCKtR3SL_376XsZfUUM0iSAur5scg99zNGWRj-sUo05wbAadYx6V6TKaWrBUi_8_0RnJyP5gbA
-BB_GRPC_LOCAL=true
\ No newline at end of file
+BB_GRPC_LOCAL=http://localhost:8080
\ No newline at end of file
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index 07fc052535..6e479b4633 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -38,9 +38,7 @@ import {
// Create each grpc service client.
// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md
-const address = import.meta.env.BB_GRPC_LOCAL
- ? "http://localhost:8080"
- : window.location.origin;
+const address = import.meta.env.BB_GRPC_LOCAL || window.location.origin;
const channel = createChannel(
address,
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index cbc928de17..41a573829d 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -10,6 +10,7 @@ import { defineConfig } from "vite";
const SERVER_PORT = parseInt(process.env.PORT ?? "3000", 10) ?? 3000;
const HTTPS_PORT = 443;
+const LOCAL_ENDPOINT = "http://localhost:8080";
export default defineConfig(() => {
// NOTE: the following lines is to solve https://github.com/gitpod-io/gitpod/issues/6719
@@ -59,16 +60,16 @@ export default defineConfig(() => {
ws: true,
},
"/api": {
- target: "http://localhost:8080/api",
+ target: `${LOCAL_ENDPOINT}/api`,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/api/, ""),
},
"/hook": {
- target: "http://localhost:8080/",
+ target: LOCAL_ENDPOINT,
changeOrigin: true,
},
"/v1": {
- target: "http://localhost:8080/v1",
+ target: `${LOCAL_ENDPOINT}/v1`,
changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/v1/, ""),
},