Skip to content

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

feat: introduce BB_REDIRECT_URL (#2626)

tianzhoue015e1fd599d
diff --git a/scripts/.air.toml b/scripts/.air.toml
index 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 = false
send_interrupt = true
kill_delay = 1000
- full_bin = ""
diff --git a/server/server_frontend_not_embed.go b/server/server_frontend_not_embed.go
index b18bb9ef5f..9691cf1de4 100644
--- a/server/server_frontend_not_embed.go
+++ b/server/server_frontend_not_embed.go
@@ -6,6 +6,7 @@ package server
import (
"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:3000
func 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)
}