Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Retrieve the backend host from backend acutator/info
天舟c2d8bdba6a3f
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex 0d6a2c59e8..e01670f2d2 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -106,7 +106,7 @@ func Execute() error {}func init() {- rootCmd.PersistentFlags().StringVar(&host, "host", "https://localhost", "host where Bytebase is accessed from, must start with http:// or https://. This is used by Bytebase to create the webhook callback endpoint for VCS integration")+ rootCmd.PersistentFlags().StringVar(&host, "host", "http://localhost", "host where Bytebase is accessed from, must start with http:// or https://. This is used by Bytebase to create the webhook callback endpoint for VCS integration")rootCmd.PersistentFlags().IntVar(&port, "port", 80, "port where Bytebase is accessed from. This is also used by Bytebase to create the webhook callback endpoint for VCS integration")rootCmd.PersistentFlags().StringVar(&dataDir, "data", ".", "directory where Bytebase stores data. If relative path is supplied, then the path is relative to the directory where bytebase is under")rootCmd.PersistentFlags().BoolVar(&readonly, "readonly", false, "whether to run in read-only mode")diff --git a/frontend/.env.dev b/frontend/.env.devindex d7fba3f837..083c815f94 100644--- a/frontend/.env.dev+++ b/frontend/.env.dev@@ -1,2 +1 @@-NODE_ENV=development-VITE_BACKEND=http://localhost:8080\ No newline at end of file+NODE_ENV=development\ No newline at end of filediff --git a/frontend/src/main.ts b/frontend/src/main.tsindex e4a7df0a13..e671e3776c 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -36,7 +36,6 @@ import highlight from "./directives/highlight";import {isDev,isRelease,- backendURL,humanizeTs,sizeToFit,urlfy,@@ -55,7 +54,6 @@ registerStoreWithRoleUtil(store);console.debug("dev:", isDev());console.debug("release:", isRelease());-console.debug("backend:", backendURL());axios.defaults.timeout = 10000;axios.interceptors.request.use((request) => {@@ -88,13 +86,12 @@ axios.interceptors.response.use(// login user's token becomes invalid. Thus we force a logout.// We could receive 401 when calling external service such as VCS provider,// in such case, we shouldn't logout.- if (- error.response.status == 401 &&- error.response.request.responseURL.startsWith(backendURL())- ) {- store.dispatch("auth/logout").then(() => {- router.push({ name: "auth.signin" });- });+ if (error.response.status == 401) {+ const host = store.getters["actuator/info"]().host;+ if (error.response.request.responseURL.startsWith(host))+ store.dispatch("auth/logout").then(() => {+ router.push({ name: "auth.signin" });+ });}if (error.response.data.message) {diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.tsindex 6772b668f3..66c22759ba 100644--- a/frontend/src/utils/util.ts+++ b/frontend/src/utils/util.ts@@ -8,16 +8,6 @@ export function isRelease(): boolean {return import.meta.env.PROD;}-// Use VITE_BACKEND as the backendURL if specified. Otherwise, just use the current host-// For dev environment, we usually set VITE_BACKEND to point to different backend.-// For production environment, we won't set VITE_BACKEND because we bundle frontend/backend as a monolithic.-export function backendURL(): string {- if (import.meta.env.VITE_BACKEND) {- return import.meta.env.VITE_BACKEND as string;- }- return window.location.origin;-}-export function humanizeTs(ts: number): string {const time = moment.utc(ts * 1000);if (moment().year() == time.year()) {diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vueindex 42d1ad6d21..47e74c4526 100644--- a/frontend/src/views/DashboardHeader.vue+++ b/frontend/src/views/DashboardHeader.vue@@ -217,7 +217,7 @@ export default {});const showSwitchPlan = computed((): boolean => {- return isDev() || store.getters["actuator/isDemo"]();+ return isDev();});const switchToOwner = () => {