Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: introduce BB_REDIRECT_URL (#2626)
tianzhoue015e1fd599d
diff --git a/scripts/.air.toml b/scripts/.air.tomlindex d0d5c6cf84..00e82ecde4 100644--- a/scripts/.air.toml+++ b/scripts/.air.toml@@ -2,7 +2,7 @@ root = "."tmp_dir = ".air"[build]- bin = './.air/bytebase --port 8080 --external-url http:\/\/localhost:3000 --data . --debug'+ full_bin = 'BB_REDIRECT_URL=http:\/\/localhost:3000 ./.air/bytebase --port 8080 --external-url http:\/\/localhost:3000 --data . --debug'## Use --tags "store.db" to enable SQL query logging against our metadata db.cmd = """go build \@@ -24,4 +24,3 @@ tmp_dir = ".air"follow_symlink = falsesend_interrupt = truekill_delay = 1000- full_bin = ""diff --git a/server/server_frontend_not_embed.go b/server/server_frontend_not_embed.goindex b18bb9ef5f..9691cf1de4 100644--- a/server/server_frontend_not_embed.go+++ b/server/server_frontend_not_embed.go@@ -6,6 +6,7 @@ package serverimport ("fmt""net/http"+ "os""github.com/labstack/echo/v4"@@ -23,9 +24,13 @@ func embedFrontend(e *echo.Echo) {// In non embedded mode, the redirect URL is the frontend URL which is different// from the external URL. By default, this frontend URL is http://localhost:3000func oauthRedirectURL(_ string) string {+ url := os.Getenv("BB_REDIRECT_URL")+ if url != "" {+ return url+ }return "http://localhost:3000"}func oauthErrorMessage(redirectURL string) string {- return fmt.Sprintf("Failed to exchange OAuth token. Make sure oauthRedirectURL: %s matches your browser host.", redirectURL)+ return fmt.Sprintf("Failed to exchange OAuth token. Make sure BB_REDIRECT_URL: %s matches your browser host.", redirectURL)}