Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: grpc channel address in release (#4303)
boojackff2eb532c383
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.tsindex 35895bc81c..7e39c0c0fb 100644--- a/frontend/src/grpcweb/index.ts+++ b/frontend/src/grpcweb/index.ts@@ -1,29 +1,43 @@import { grpc } from "@improbable-eng/grpc-web";-import { createChannel, createClientFactory } from "nice-grpc-web";+import { Channel, createChannel, createClientFactory } from "nice-grpc-web";import { AuthServiceDefinition } from "@/types/proto/v1/auth_service";+import { isDev } from "@/utils";// Create each grpc service client.// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md-const channel = createChannel(- "http://localhost:8080",- grpc.CrossBrowserHttpTransport({- withCredentials: true,- })-);+let channelCache: Channel | undefined = undefined;++const getChannel = () => {+ if (channelCache) {+ return channelCache;+ }++ // In dev mode, the grpc host is `http://localhost:8080`.+ // In non-dev mode, as the frontend is embedded into server,+ // the grpc host is equal to the frontend origin location.+ const address = isDev() ? "http://localhost:8080" : window.location.origin;+ const channel = createChannel(+ address,+ grpc.CrossBrowserHttpTransport({+ withCredentials: true,+ })+ );+ channelCache = channel;+ return channelCache;+};const clientFactory = createClientFactory();-export const authServiceClient = clientFactory.create(- AuthServiceDefinition,- channel-);+export const authServiceClient = () => {+ return clientFactory.create(AuthServiceDefinition, getChannel());+};// e.g. How to use `authServiceClient`?//-// await authServiceClient.login({+// await authServiceClient().login({// email: "[email protected]",// password: "bb",// web: true,// });-// const { users } = await authServiceClient.listUsers({});+// const { users } = await authServiceClient().listUsers({});diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.tsindex ca49c46891..f032eebea9 100644--- a/frontend/src/store/modules/auth.ts+++ b/frontend/src/store/modules/auth.ts@@ -95,7 +95,7 @@ export const useAuthStore = defineStore("auth", {return unknownPrincipal;},async signup(signupInfo: SignupInfo) {- await authServiceClient.createUser({+ await authServiceClient().createUser({user: {email: signupInfo.email,title: signupInfo.name,