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: make --external-url flag take precedence over database setting (#18281)
Danny Xud94854d13183
diff --git a/backend/api/directory-sync/directory_sync.go b/backend/api/directory-sync/directory_sync.goindex a8b8c0a1ca..9fa505900c 100644--- a/backend/api/directory-sync/directory_sync.go+++ b/backend/api/directory-sync/directory_sync.go@@ -1,6 +1,7 @@package directorysyncimport (+ "github.com/bytebase/bytebase/backend/component/config""github.com/bytebase/bytebase/backend/component/iam""github.com/bytebase/bytebase/backend/enterprise""github.com/bytebase/bytebase/backend/store"@@ -11,6 +12,7 @@ type Service struct {store *store.StorelicenseService *enterprise.LicenseServiceiamManager *iam.Manager+ profile *config.Profile}// NewService creates a SCIM service.@@ -18,10 +20,12 @@ func NewService(store *store.Store,licenseService *enterprise.LicenseService,iamManager *iam.Manager,+ profile *config.Profile,) *Service {return &Service{store: store,licenseService: licenseService,iamManager: iamManager,+ profile: profile,}}diff --git a/backend/api/directory-sync/webhook.go b/backend/api/directory-sync/webhook.goindex 1ffb685d48..da464144fe 100644--- a/backend/api/directory-sync/webhook.go+++ b/backend/api/directory-sync/webhook.go@@ -609,7 +609,9 @@ func (s *Service) validRequestURL(ctx context.Context, c echo.Context) error {if err != nil {return err}- if setting.ExternalUrl == "" {+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(s.profile.ExternalURL, setting.ExternalUrl)+ if externalURL == "" {return errors.Errorf("external URL is empty")}diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.goindex 56aaab1d20..be4ad12feb 100644--- a/backend/api/v1/actuator_service.go+++ b/backend/api/v1/actuator_service.go@@ -170,13 +170,19 @@ func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfo// Check if sample instances are availablehasSampleInstances, _ := s.store.HasSampleInstances(ctx)+ // Prefer command-line flag over database value for external URL+ externalURL := setting.ExternalUrl+ if s.profile.ExternalURL != "" {+ externalURL = s.profile.ExternalURL+ }+serverInfo := v1pb.ActuatorInfo{Version: s.profile.Version,GitCommit: s.profile.GitCommit,Saas: s.profile.SaaS,Demo: s.profile.Demo,NeedAdminSetup: count == 0,- ExternalUrl: setting.ExternalUrl,+ ExternalUrl: externalURL,DisallowSignup: setting.DisallowSignup || s.profile.SaaS,Require_2Fa: setting.Require_2Fa,LastActiveTime: timestamppb.New(time.Unix(s.profile.LastActiveTS.Load(), 0)),@@ -187,6 +193,7 @@ func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfoDisallowPasswordSignin: setting.DisallowPasswordSignin,PasswordRestriction: passwordSetting,EnableSample: hasSampleInstances,+ ExternalUrlFromFlag: s.profile.ExternalURL != "",}stats, err := s.store.StatUsers(ctx)diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex e9a760a649..a67f8d061f 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -339,6 +339,9 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace setting"))}+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(s.profile.ExternalURL, setting.ExternalUrl)+var userInfo *storepb.IdentityProviderUserInfoswitch idp.Type {case storepb.IdentityProviderType_OAUTH2:@@ -350,7 +353,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create new OAuth2 identity provider"))}- redirectURL := fmt.Sprintf("%s/oauth/callback", setting.ExternalUrl)+ redirectURL := fmt.Sprintf("%s/oauth/callback", externalURL)token, err := oauth2IdentityProvider.ExchangeToken(ctx, redirectURL, oauth2Context.Code)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to exchange token"))@@ -370,7 +373,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to create new OIDC identity provider"))}- redirectURL := fmt.Sprintf("%s/oidc/callback", setting.ExternalUrl)+ redirectURL := fmt.Sprintf("%s/oidc/callback", externalURL)token, err := oidcIDP.ExchangeToken(ctx, redirectURL, oidcContext.Code)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to exchange token"))diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.goindex 3916e71f8e..15ff503b1f 100644--- a/backend/api/v1/idp_service.go+++ b/backend/api/v1/idp_service.go@@ -12,6 +12,7 @@ import ("github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"+ "github.com/bytebase/bytebase/backend/component/config""github.com/bytebase/bytebase/backend/enterprise"storepb "github.com/bytebase/bytebase/backend/generated-go/store"v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"@@ -27,13 +28,15 @@ type IdentityProviderService struct {v1connect.UnimplementedIdentityProviderServiceHandlerstore *store.StorelicenseService *enterprise.LicenseService+ profile *config.Profile}// NewIdentityProviderService creates a new IdentityProviderService.-func NewIdentityProviderService(store *store.Store, licenseService *enterprise.LicenseService) *IdentityProviderService {+func NewIdentityProviderService(store *store.Store, licenseService *enterprise.LicenseService, profile *config.Profile) *IdentityProviderService {return &IdentityProviderService{store: store,licenseService: licenseService,+ profile: profile,}}@@ -71,7 +74,9 @@ func (s *IdentityProviderService) CreateIdentityProvider(ctx context.Context, reif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace setting"))}- if setting.ExternalUrl == "" {+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(s.profile.ExternalURL, setting.ExternalUrl)+ if externalURL == "" {return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf(setupExternalURLError))}@@ -228,7 +233,9 @@ func (s *IdentityProviderService) TestIdentityProvider(ctx context.Context, reqif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace setting"))}- if setting.ExternalUrl == "" {+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(s.profile.ExternalURL, setting.ExternalUrl)+ if externalURL == "" {return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf(setupExternalURLError))}diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex ed2b8194aa..4e53fd0a12 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -987,7 +987,9 @@ func (s *ProjectService) TestWebhook(ctx context.Context, req *connect.Request[vif err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get workspace setting"))}- if setting.ExternalUrl == "" {+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(s.profile.ExternalURL, setting.ExternalUrl)+ if externalURL == "" {return nil, connect.NewError(connect.CodeFailedPrecondition, errors.Errorf(setupExternalURLError))}@@ -1028,7 +1030,7 @@ func (s *ProjectService) TestWebhook(ctx context.Context, req *connect.Request[vTitle: fmt.Sprintf("Test webhook %q", webhook.Payload.GetTitle()),TitleZh: fmt.Sprintf("测试 webhook %q", webhook.Payload.GetTitle()),Description: "This is a test",- Link: fmt.Sprintf("%s/projects/%s/webhooks/%s", setting.ExternalUrl, project.ResourceID, fmt.Sprintf("%s-%d", slug.Make(webhook.Payload.GetTitle()), webhook.ID)),+ Link: fmt.Sprintf("%s/projects/%s/webhooks/%s", externalURL, project.ResourceID, fmt.Sprintf("%s-%d", slug.Make(webhook.Payload.GetTitle()), webhook.ID)),ActorID: common.SystemBotID,ActorName: "Bytebase",ActorEmail: s.store.GetSystemBotUser(ctx).Email,diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.goindex aaf9636f7a..ae99da74db 100644--- a/backend/api/v1/setting_service.go+++ b/backend/api/v1/setting_service.go@@ -195,6 +195,10 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Reqif s.profile.SaaS {return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("feature %s is unavailable in current mode", settingName))}+ // Prevent changing external URL via UI when it's set via command-line flag+ if s.profile.ExternalURL != "" {+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("external URL is managed via --external-url command-line flag and cannot be changed through the UI"))+ }if payload.ExternalUrl != "" {externalURL, err := common.NormalizeExternalURL(payload.ExternalUrl)if err != nil {diff --git a/backend/common/util.go b/backend/common/util.goindex 362eda86ea..68b6b2f245 100644--- a/backend/common/util.go+++ b/backend/common/util.go@@ -123,6 +123,15 @@ func Unobfuscate(dst, seed string) (string, error) {return string(unobfuscated), nil}+// GetEffectiveExternalURL returns the external URL to use, preferring the command-line flag over the database setting.+// This ensures that when the --external-url flag is set, it takes precedence over any value stored in the database.+func GetEffectiveExternalURL(flagValue, dbValue string) string {+ if flagValue != "" {+ return flagValue+ }+ return dbValue+}+// NormalizeExternalURL will format the external url.func NormalizeExternalURL(url string) (string, error) {r := strings.TrimSpace(url)diff --git a/backend/component/webhook/manager.go b/backend/component/webhook/manager.goindex 3b324992bf..c7e0bdd588 100644--- a/backend/component/webhook/manager.go+++ b/backend/component/webhook/manager.go@@ -11,6 +11,7 @@ import ("github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"+ "github.com/bytebase/bytebase/backend/component/config""github.com/bytebase/bytebase/backend/component/iam"storepb "github.com/bytebase/bytebase/backend/generated-go/store""github.com/bytebase/bytebase/backend/plugin/webhook"@@ -24,6 +25,7 @@ import (type Manager struct {store *store.StoreiamManager *iam.Manager+ profile *config.Profile}// Metadata is the activity metadata.@@ -34,10 +36,11 @@ type Metadata struct {type UsersGetter func(ctx context.Context) ([]*store.UserMessage, error)// NewManager creates an activity manager.-func NewManager(store *store.Store, iamManager *iam.Manager) *Manager {+func NewManager(store *store.Store, iamManager *iam.Manager, profile *config.Profile) *Manager {return &Manager{store: store,iamManager: iamManager,+ profile: profile,}}@@ -75,15 +78,18 @@ func (m *Manager) getWebhookContextFromEvent(ctx context.Context, e *Event, evenreturn nil, errors.Wrapf(err, "failed to get workspace setting")}+ // Use command-line flag value if set, otherwise use database value+ externalURL := common.GetEffectiveExternalURL(m.profile.ExternalURL, setting.ExternalUrl)+level := webhook.WebhookInfotitle := ""titleZh := ""link := ""if e.Issue != nil {// TODO(steven): Remove the slug dependency when the legacy issue page is removed.- link = fmt.Sprintf("%s/projects/%s/issues/%s-%d", setting.ExternalUrl, e.Project.ResourceID, slug.Make(e.Issue.Title), e.Issue.UID)+ link = fmt.Sprintf("%s/projects/%s/issues/%s-%d", externalURL, e.Project.ResourceID, slug.Make(e.Issue.Title), e.Issue.UID)} else if e.Rollout != nil {- link = fmt.Sprintf("%s/projects/%s/rollouts/%d", setting.ExternalUrl, e.Project.ResourceID, e.Rollout.UID)+ link = fmt.Sprintf("%s/projects/%s/rollouts/%d", externalURL, e.Project.ResourceID, e.Rollout.UID)}switch e.Type {case storepb.Activity_ISSUE_CREATE:diff --git a/backend/generated-go/v1/actuator_service.pb.go b/backend/generated-go/v1/actuator_service.pb.goindex 7829f307a2..9bef3b157f 100644--- a/backend/generated-go/v1/actuator_service.pb.go+++ b/backend/generated-go/v1/actuator_service.pb.go@@ -331,9 +331,11 @@ type ActuatorInfo struct {// The total number of database instances.TotalInstanceCount int32 `protobuf:"varint,25,opt,name=total_instance_count,json=totalInstanceCount,proto3" json:"total_instance_count,omitempty"`// Whether sample data setup is enabled.- EnableSample bool `protobuf:"varint,26,opt,name=enable_sample,json=enableSample,proto3" json:"enable_sample,omitempty"`- unknownFields protoimpl.UnknownFields- sizeCache protoimpl.SizeCache+ EnableSample bool `protobuf:"varint,26,opt,name=enable_sample,json=enableSample,proto3" json:"enable_sample,omitempty"`+ // Whether the external URL is set via command-line flag (and thus cannot be changed via UI).+ ExternalUrlFromFlag bool `protobuf:"varint,27,opt,name=external_url_from_flag,json=externalUrlFromFlag,proto3" json:"external_url_from_flag,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache}func (x *ActuatorInfo) Reset() {@@ -520,6 +522,13 @@ func (x *ActuatorInfo) GetEnableSample() bool {return false}+func (x *ActuatorInfo) GetExternalUrlFromFlag() bool {+ if x != nil {+ return x.ExternalUrlFromFlag+ }+ return false+}+// User statistics by type and state.type ActuatorInfo_StatUser struct {state protoimpl.MessageState `protogen:"open.v1"`@@ -599,7 +608,7 @@ const file_v1_actuator_service_proto_rawDesc = "" +"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +"updateMask\x12#\n" +"\rallow_missing\x18\x03 \x01(\bR\fallowMissing\"\x14\n" +- "\x12DeleteCacheRequest\"\xe5\b\n" ++ "\x12DeleteCacheRequest\"\x9f\t\n" +"\fActuatorInfo\x12\x1d\n" +"\aversion\x18\x01 \x01(\tB\x03\xe0A\x03R\aversion\x12\"\n" +"\n" +@@ -626,7 +635,8 @@ const file_v1_actuator_service_proto_rawDesc = "" +"user_stats\x18\x17 \x03(\v2\".bytebase.v1.ActuatorInfo.StatUserB\x03\xe0A\x03R\tuserStats\x12=\n" +"\x18activated_instance_count\x18\x18 \x01(\x05B\x03\xe0A\x03R\x16activatedInstanceCount\x125\n" +"\x14total_instance_count\x18\x19 \x01(\x05B\x03\xe0A\x03R\x12totalInstanceCount\x12(\n" +- "\renable_sample\x18\x1a \x01(\bB\x03\xe0A\x03R\fenableSample\x1a~\n" ++ "\renable_sample\x18\x1a \x01(\bB\x03\xe0A\x03R\fenableSample\x128\n" ++ "\x16external_url_from_flag\x18\x1b \x01(\bB\x03\xe0A\x03R\x13externalUrlFromFlag\x1a~\n" +"\bStatUser\x122\n" +"\tuser_type\x18\x01 \x01(\x0e2\x15.bytebase.v1.UserTypeR\buserType\x12(\n" +"\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +diff --git a/backend/generated-go/v1/actuator_service_equal.pb.go b/backend/generated-go/v1/actuator_service_equal.pb.goindex 30447c446c..f15c4f78df 100644--- a/backend/generated-go/v1/actuator_service_equal.pb.go+++ b/backend/generated-go/v1/actuator_service_equal.pb.go@@ -186,5 +186,8 @@ func (x *ActuatorInfo) Equal(y *ActuatorInfo) bool {if x.EnableSample != y.EnableSample {return false}+ if x.ExternalUrlFromFlag != y.ExternalUrlFromFlag {+ return false+ }return true}diff --git a/backend/server/grpc_routes.go b/backend/server/grpc_routes.goindex e316615a1b..502b55f42b 100644--- a/backend/server/grpc_routes.go+++ b/backend/server/grpc_routes.go@@ -79,7 +79,7 @@ func configureGrpcRouters(databaseGroupService := apiv1.NewDatabaseGroupService(stores, profile, iamManager, licenseService)databaseService := apiv1.NewDatabaseService(stores, schemaSyncer, licenseService, profile, iamManager)groupService := apiv1.NewGroupService(stores, iamManager, licenseService)- identityProviderService := apiv1.NewIdentityProviderService(stores, licenseService)+ identityProviderService := apiv1.NewIdentityProviderService(stores, licenseService, profile)instanceRoleService := apiv1.NewInstanceRoleService(stores, dbFactory)instanceService := apiv1.NewInstanceService(stores, profile, licenseService, metricReporter, stateCfg, dbFactory, schemaSyncer, iamManager, sampleInstanceManager)issueService := apiv1.NewIssueService(stores, webhookManager, stateCfg, licenseService, profile, iamManager, metricReporter)diff --git a/backend/server/init.go b/backend/server/init.goindex fe6d57653a..3c000a3b75 100644--- a/backend/server/init.go+++ b/backend/server/init.go@@ -146,32 +146,15 @@ func (s *Server) initializeSetting(ctx context.Context) error {return err}- // initial workspace profile setting- workspaceProfileSetting, err := s.store.GetSettingV2(ctx, storepb.SettingName_WORKSPACE_PROFILE)- if err != nil {- return err- }-+ // Initialize workspace profile setting only if it doesn't existworkspaceProfilePayload := &storepb.WorkspaceProfileSetting{- ExternalUrl: s.profile.ExternalURL,- EnableMetricCollection: true, // Default to enabled for new installations+ EnableMetricCollection: true,}- if workspaceProfileSetting != nil {- workspaceProfilePayload = new(storepb.WorkspaceProfileSetting)- if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(workspaceProfileSetting.Value), workspaceProfilePayload); err != nil {- return err- }- if s.profile.ExternalURL != "" {- workspaceProfilePayload.ExternalUrl = s.profile.ExternalURL- }- }-bytes, err := protojson.Marshal(workspaceProfilePayload)if err != nil {return err}-- if _, err := s.store.UpsertSettingV2(ctx, &store.SetSettingMessage{+ if _, _, err := s.store.CreateSettingIfNotExistV2(ctx, &store.SettingMessage{Name: storepb.SettingName_WORKSPACE_PROFILE,Value: string(bytes),}); err != nil {diff --git a/backend/server/server.go b/backend/server/server.goindex d6a66023b8..c892c6192f 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -179,7 +179,7 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {if err != nil {return nil, errors.Wrapf(err, "failed to create iam manager")}- s.webhookManager = webhook.NewManager(stores, s.iamManager)+ s.webhookManager = webhook.NewManager(stores, s.iamManager, profile)s.dbFactory = dbfactory.New(s.store, s.licenseService)// Configure echo server.@@ -214,7 +214,7 @@ func NewServer(ctx context.Context, profile *config.Profile) (*Server, error) {// LSP server.s.lspServer = lsp.NewServer(s.store, profile, secret, s.stateCfg, s.iamManager, s.licenseService)- directorySyncServer := directorysync.NewService(s.store, s.licenseService, s.iamManager)+ directorySyncServer := directorysync.NewService(s.store, s.licenseService, s.iamManager, profile)if err := configureGrpcRouters(ctx, s.echoServer, s.store, sheetManager, s.dbFactory, s.licenseService, s.profile, s.metricReporter, s.stateCfg, s.schemaSyncer, s.webhookManager, s.iamManager, secret, s.sampleInstanceManager); err != nil {return nil, errors.Wrapf(err, "failed to configure gRPC routers")diff --git a/backend/tests/tests.go b/backend/tests/tests.goindex cf16295c4d..f99093393f 100644--- a/backend/tests/tests.go+++ b/backend/tests/tests.go@@ -213,6 +213,8 @@ func (ctl *controller) StartServerWithExternalPg(ctx context.Context) (context.C}func (ctl *controller) initWorkspaceProfile(ctx context.Context) error {+ // Don't set external_url in the database if it's set via profile (command-line flag),+ // as our validation will reject it. The profile value takes precedence at runtime._, err := ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{AllowMissing: true,Setting: &v1pb.Setting{@@ -220,7 +222,6 @@ func (ctl *controller) initWorkspaceProfile(ctx context.Context) error {Value: &v1pb.Value{Value: &v1pb.Value_WorkspaceProfileSettingValue{WorkspaceProfileSettingValue: &v1pb.WorkspaceProfileSetting{- ExternalUrl: ctl.profile.ExternalURL,DisallowSignup: false,},},@@ -229,7 +230,6 @@ func (ctl *controller) initWorkspaceProfile(ctx context.Context) error {UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"value.workspace_profile_setting_value.disallow_signup",- "value.workspace_profile_setting_value.external_url",},},}))diff --git a/frontend/src/components/GeneralSetting/GeneralSetting.vue b/frontend/src/components/GeneralSetting/GeneralSetting.vueindex a82bdd4ce5..d9e8e75f38 100644--- a/frontend/src/components/GeneralSetting/GeneralSetting.vue+++ b/frontend/src/components/GeneralSetting/GeneralSetting.vue@@ -25,16 +25,26 @@url="https://docs.bytebase.com/get-started/self-host/external-url?source=console"/></div>- <NTooltip placement="top-start" :disabled="allowEdit">+ <div v-if="externalUrlFromFlag" class="mb-2 text-sm text-accent">+ {{ $t("settings.general.workspace.external-url.managed-by-flag") }}+ </div>+ <NTooltip+ placement="top-start"+ :disabled="allowEdit && !externalUrlFromFlag"+ ><template #trigger><NInputv-model:value="state.externalUrl"class="mb-4 w-full"- :disabled="!allowEdit || isSaaSMode"+ :disabled="!allowEdit || isSaaSMode || externalUrlFromFlag"/></template><span class="text-sm text-gray-400 -translate-y-2">- {{ $t("settings.general.workspace.only-admin-can-edit") }}+ {{+ externalUrlFromFlag+ ? $t("settings.general.workspace.external-url.cannot-edit-flag")+ : $t("settings.general.workspace.only-admin-can-edit")+ }}</span></NTooltip></div>@@ -117,6 +127,10 @@ const { isSaaSMode } = storeToRefs(actuatorV1Store);const state = reactive<LocalState>(getInitialState());const showModal = ref(false);+const externalUrlFromFlag = computed(() => {+ return actuatorV1Store.serverInfo?.externalUrlFromFlag ?? false;+});+const allowSave = computed((): boolean => {return !isEqual(state, getInitialState());});diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 95e4ea7011..cecc9266c5 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -633,7 +633,9 @@},"external-url": {"self": "External URL",- "description": "The external URL where user visits Bytebase, must start with http:// or https://."+ "description": "The external URL where user visits Bytebase, must start with http:// or https://.",+ "managed-by-flag": "This setting is managed via the --external-url command-line flag",+ "cannot-edit-flag": "External URL cannot be changed because it is set via --external-url command-line flag"},"sign-in-frequency": {"self": "Sign-in frequency",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex e29230195a..3da7f204fe 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -633,7 +633,9 @@},"external-url": {"self": "URL Externa",- "description": "La URL externa donde el usuario visita Bytebase, debe comenzar con http:// o https://."+ "description": "La URL externa donde el usuario visita Bytebase, debe comenzar con http:// o https://.",+ "managed-by-flag": "Esta configuración está gestionada a través del parámetro de línea de comandos --external-url",+ "cannot-edit-flag": "La URL externa no se puede cambiar porque está configurada mediante el parámetro de línea de comandos --external-url"},"sign-in-frequency": {"self": "Frecuencia de inicio de sesión",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 78b17867c9..945afdd66e 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -633,7 +633,9 @@},"external-url": {"self": "外部URL",- "description": "ユーザーまたはコールバックがアクセスできる Bytebase URL は、http:// または https:// で始まる必要があります。"+ "description": "ユーザーまたはコールバックがアクセスできる Bytebase URL は、http:// または https:// で始まる必要があります。",+ "managed-by-flag": "この設定は --external-url コマンドラインフラグによって管理されています",+ "cannot-edit-flag": "外部URLは --external-url コマンドラインフラグで設定されているため変更できません"},"sign-in-frequency": {"self": "ログイン頻度",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex e11e72dc33..213ee2adff 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -633,7 +633,9 @@},"external-url": {"self": "URL bên ngoài",- "description": "URL bên ngoài mà người dùng truy cập Bytebase, phải bắt đầu bằng http:// hoặc https://."+ "description": "URL bên ngoài mà người dùng truy cập Bytebase, phải bắt đầu bằng http:// hoặc https://.",+ "managed-by-flag": "Cài đặt này được quản lý thông qua tham số dòng lệnh --external-url",+ "cannot-edit-flag": "Không thể thay đổi URL bên ngoài vì nó được đặt thông qua tham số dòng lệnh --external-url"},"sign-in-frequency": {"self": "Tần suất đăng nhập",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex fbb9e02b15..1ce0e16220 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -633,7 +633,9 @@},"external-url": {"self": "External URL",- "description": "用户或回调能访问到的 Bytebase URL,必须以 http:// 或 https:// 开头。"+ "description": "用户或回调能访问到的 Bytebase URL,必须以 http:// 或 https:// 开头。",+ "managed-by-flag": "此设置由 --external-url 命令行参数管理",+ "cannot-edit-flag": "外部 URL 无法更改,因为它是通过 --external-url 命令行参数设置的"},"sign-in-frequency": {"self": "登录频率",diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts b/frontend/src/types/proto-es/v1/actuator_service_pb.d.tsindex 99fd33a5ea..cbe8ea1944 100644--- a/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.d.ts@@ -285,6 +285,13 @@ export declare type ActuatorInfo = Message<"bytebase.v1.ActuatorInfo"> & {* @generated from field: bool enable_sample = 26;*/enableSample: boolean;++ /**+ * Whether the external URL is set via command-line flag (and thus cannot be changed via UI).+ *+ * @generated from field: bool external_url_from_flag = 27;+ */+ externalUrlFromFlag: boolean;};/**diff --git a/frontend/src/types/proto-es/v1/actuator_service_pb.js b/frontend/src/types/proto-es/v1/actuator_service_pb.jsindex 004c06ee63..d0865ff2ba 100644--- a/frontend/src/types/proto-es/v1/actuator_service_pb.js+++ b/frontend/src/types/proto-es/v1/actuator_service_pb.js@@ -16,7 +16,7 @@ import { file_v1_user_service } from "./user_service_pb";* Describes the file v1/actuator_service.proto.*/export const file_v1_actuator_service = /*@__PURE__*/- fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIbChlHZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0Ih8KD1Jlc291cmNlUGFja2FnZRIMCgRsb2dvGAEgASgMIhQKElNldHVwU2FtcGxlUmVxdWVzdCIYChZHZXRBY3R1YXRvckluZm9SZXF1ZXN0IpoBChlVcGRhdGVBY3R1YXRvckluZm9SZXF1ZXN0EjAKCGFjdHVhdG9yGAEgASgLMhkuYnl0ZWJhc2UudjEuQWN0dWF0b3JJbmZvQgPgQQISNAoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrQgPgQQISFQoNYWxsb3dfbWlzc2luZxgDIAEoCCIUChJEZWxldGVDYWNoZVJlcXVlc3QirAYKDEFjdHVhdG9ySW5mbxIUCgd2ZXJzaW9uGAEgASgJQgPgQQMSFwoKZ2l0X2NvbW1pdBgCIAEoCUID4EEDEhUKCHJlYWRvbmx5GAMgASgIQgPgQQMSEQoEc2FhcxgEIAEoCEID4EEDEhEKBGRlbW8YBSABKAhCA+BBAxIRCgRob3N0GAYgASgJQgPgQQMSEQoEcG9ydBgHIAEoCUID4EEDEhkKDGV4dGVybmFsX3VybBgIIAEoCUID4EEDEh0KEG5lZWRfYWRtaW5fc2V0dXAYCSABKAhCA+BBAxIcCg9kaXNhbGxvd19zaWdudXAYCiABKAhCA+BBAxI5ChBsYXN0X2FjdGl2ZV90aW1lGAsgASgLMhouZ29vZ2xlLnByb3RvYn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Y3R1YXRvcjIRL3YxL2FjdHVhdG9yL2luZm8SggEKC1NldHVwU2FtcGxlEh8uYnl0ZWJhc2UudjEuU2V0dXBTYW1wbGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IjqK6jASYmIucHJvamVjdHMuY3JlYXRlkOowAYLT5JMCGiIYL3YxL2FjdHVhdG9yOnNldHVwU2FtcGxlEmYKC0RlbGV0ZUNhY2hlEh8uYnl0ZWJhc2UudjEuRGVsZXRlQ2FjaGVSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Ih6A6jABgtPkkwIUKhIvdjEvYWN0dWF0b3IvY2FjaGUSgQEKEkdldFJlc291cmNlUGFja2FnZRImLmJ5dGViYXNlLnYxLkdldFJlc291cmNlUGFja2FnZVJlcXVlc3QaHC5ieXRlYmFzZS52MS5SZXNvdXJjZVBhY2thZ2UiJdpBAIDqMAGC0+STAhgSFi92MS9hY3R1YXRvci9yZXNvdXJjZXNCqgEKD2NvbS5ieXRlYmFzZS52MUIUQWN0dWF0b3JTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_setting_service, file_v1_user_service]);+ fileDesc("Chl2MS9hY3R1YXRvcl9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSIbChlHZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0Ih8KD1Jlc291cmNlUGFja2FnZRIMCgRsb2dvGAEgASgMIhQKElNldHVwU2FtcGxlUmVxdWVzdCIY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hY2hlEoEBChJHZXRSZXNvdXJjZVBhY2thZ2USJi5ieXRlYmFzZS52MS5HZXRSZXNvdXJjZVBhY2thZ2VSZXF1ZXN0GhwuYnl0ZWJhc2UudjEuUmVzb3VyY2VQYWNrYWdlIiXaQQCA6jABgtPkkwIYEhYvdjEvYWN0dWF0b3IvcmVzb3VyY2VzQqoBCg9jb20uYnl0ZWJhc2UudjFCFEFjdHVhdG9yU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation, file_v1_common, file_v1_setting_service, file_v1_user_service]);/*** Describes the message bytebase.v1.GetResourcePackageRequest.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex d4b4cfe0d5..f3a3859457 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -7964,6 +7964,10 @@ components:readOnly: truetype: booleandescription: Whether sample data setup is enabled.+ externalUrlFromFlag:+ readOnly: true+ type: boolean+ description: Whether the external URL is set via command-line flag (and thus cannot be changed via UI).description: |-System information and configuration for the Bytebase instance.Actuator concept is similar to the Spring Boot Actuator.diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 1c6380fcec..c16d84364c 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -5787,6 +5787,7 @@ Actuator concept is similar to the Spring Boot Actuator.| activated_instance_count | [int32](#int32) | | The number of activated database instances. || total_instance_count | [int32](#int32) | | The total number of database instances. || enable_sample | [bool](#bool) | | Whether sample data setup is enabled. |+| external_url_from_flag | [bool](#bool) | | Whether the external URL is set via command-line flag (and thus cannot be changed via UI). |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 56adb84236..b1e0042272 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -16831,6 +16831,13 @@ Permissions required: bb.users.undelete</p></td><td><p>Whether sample data setup is enabled. </p></td></tr>+ <tr>+ <td>external_url_from_flag</td>+ <td><a href="#bool">bool</a></td>+ <td></td>+ <td><p>Whether the external URL is set via command-line flag (and thus cannot be changed via UI). </p></td>+ </tr>+</tbody></table>diff --git a/proto/v1/v1/actuator_service.proto b/proto/v1/v1/actuator_service.protoindex 54956a0d2f..be213429ca 100644--- a/proto/v1/v1/actuator_service.proto+++ b/proto/v1/v1/actuator_service.proto@@ -172,4 +172,7 @@ message ActuatorInfo {// Whether sample data setup is enabled.bool enable_sample = 26 [(google.api.field_behavior) = OUTPUT_ONLY];++ // Whether the external URL is set via command-line flag (and thus cannot be changed via UI).+ bool external_url_from_flag = 27 [(google.api.field_behavior) = OUTPUT_ONLY];}