Skip to content

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

feat: introduce --saas flag (#4954)

ecmadao1641cce39931
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
new file mode 100644
index 0000000000..d402182c8f
--- /dev/null
+++ b/backend/api/v1/actuator_service.go
@@ -0,0 +1,58 @@
+package v1
+
+import (
+ "context"
+
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+
+ "github.com/bytebase/bytebase/backend/component/config"
+ api "github.com/bytebase/bytebase/backend/legacyapi"
+ "github.com/bytebase/bytebase/backend/store"
+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
+)
+
+// ActuatorService implements the actuator service.
+type ActuatorService struct {
+ v1pb.UnimplementedActuatorServiceServer
+ store *store.Store
+ profile *config.Profile
+}
+
+// NewActuatorService creates a new ActuatorService.
+func NewActuatorService(store *store.Store, profile *config.Profile) *ActuatorService {
+ return &ActuatorService{
+ store: store,
+ profile: profile,
+ }
+}
+
+// GetActuatorInfo gets the actuator info.
+func (s *ActuatorService) GetActuatorInfo(ctx context.Context, _ *v1pb.GetActuatorInfoRequest) (*v1pb.ActuatorInfo, error) {
+ return s.getServerInfo(ctx)
+}
+
+func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfo, error) {
+ count, err := s.store.CountUsers(ctx, api.EndUser)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, err.Error())
+ }
+
+ setting, err := s.store.GetWorkspaceGeneralSetting(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to find workspace setting: %v", err)
+ }
+
+ serverInfo := v1pb.ActuatorInfo{
+ Version: s.profile.Version,
+ GitCommit: s.profile.GitCommit,
+ Readonly: s.profile.Readonly,
+ Saas: s.profile.SaaS,
+ DemoName: s.profile.DemoName,
+ NeedAdminSetup: count == 0,
+ ExternalUrl: setting.ExternalUrl,
+ DisallowSignup: setting.DisallowSignup,
+ }
+
+ return &serverInfo, nil
+}
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 5c2fc65e69..da04da75bd 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -2,26 +2,31 @@ package v1
import (
"context"
+ "encoding/json"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/bytebase/bytebase/backend/common"
+ "github.com/bytebase/bytebase/backend/component/config"
api "github.com/bytebase/bytebase/backend/legacyapi"
"github.com/bytebase/bytebase/backend/store"
+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
)
// SettingService implements the setting service.
type SettingService struct {
v1pb.UnimplementedSettingServiceServer
- store *store.Store
+ store *store.Store
+ profile *config.Profile
}
// NewSettingService creates a new setting service.
-func NewSettingService(store *store.Store) *SettingService {
+func NewSettingService(store *store.Store, profile *config.Profile) *SettingService {
return &SettingService{
- store: store,
+ store: store,
+ profile: profile,
}
}
@@ -70,10 +75,32 @@ func (s *SettingService) SetSetting(ctx context.Context, request *v1pb.SetSettin
if settingName == "" {
return nil, status.Errorf(codes.InvalidArgument, "setting name is empty")
}
+ if s.profile.IsFeatureUnavailable(settingName) {
+ return nil, status.Errorf(codes.InvalidArgument, "feature %s is unavailable in current mode", settingName)
+ }
+
apiSettingName := api.SettingName(settingName)
+ settingValue := request.Setting.Value.GetStringValue()
+ if apiSettingName == api.SettingWorkspaceGeneral {
+ payload := new(storepb.WorkspaceGeneralSettingPayload)
+ if err := json.Unmarshal([]byte(settingValue), payload); err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to unmarshal setting value: %v", err)
+ }
+ externalURL, err := common.NormalizeExternalURL(payload.ExternalUrl)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid external url: %v", err)
+ }
+ payload.ExternalUrl = externalURL
+ bytes, err := json.Marshal(payload)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to marshal setting value: %v", err)
+ }
+ settingValue = string(bytes)
+ }
+
setting, err := s.store.UpsertSettingV2(ctx, &store.SetSettingMessage{
Name: apiSettingName,
- Value: request.Setting.Value.GetStringValue(),
+ Value: settingValue,
}, ctx.Value(common.PrincipalIDContextKey).(int))
if err != nil {
return nil, err
diff --git a/backend/bin/server/cmd/profile.go b/backend/bin/server/cmd/profile.go
index fc51f18915..4e785ac80c 100644
--- a/backend/bin/server/cmd/profile.go
+++ b/backend/bin/server/cmd/profile.go
@@ -19,6 +19,7 @@ func getBaseProfile(dataDir string) config.Profile {
DatastorePort: flags.port + 2, // Using flags.port + 2 as our datastore port.
SampleDatabasePort: flags.port + 3, // Using flags.port + 3 as our sample database port.
Readonly: flags.readonly,
+ SaaS: flags.saas,
DataDir: dataDir,
ResourceDir: common.GetResourceDir(dataDir),
Debug: flags.debug,
diff --git a/backend/bin/server/cmd/root.go b/backend/bin/server/cmd/root.go
index 225c243e59..00af4adff3 100644
--- a/backend/bin/server/cmd/root.go
+++ b/backend/bin/server/cmd/root.go
@@ -19,7 +19,6 @@ import (
"github.com/bytebase/bytebase/backend/common"
"github.com/bytebase/bytebase/backend/common/log"
"github.com/bytebase/bytebase/backend/server"
- "github.com/bytebase/bytebase/backend/utils"
)
// -----------------------------------Global constant BEGIN----------------------------------------.
@@ -72,6 +71,8 @@ var (
// - Requests other than GET will be rejected
// - Any operations involving mutation will not start (e.g. Background schema syncer, task scheduler)
readonly bool
+ // saas means the Bytebase is running in SaaS mode, several features is only controlled by us instead of users under this mode.
+ saas bool
// demoName is the name of the demo and should be one of the subpath name in the ./store/demo/ directory.
// empty means no demo.
demoName string
@@ -116,9 +117,10 @@ func init() {
// 1. Constructing the correct callback URL when configuring the VCS provider. The callback URL points to the frontend.
// 2. Creating the correct webhook endpoint when configuring the project GitOps workflow. The webhook endpoint points to the backend.
// Since frontend and backend are bundled and run on the same address in the release build, thus we just need to specify a single external URL.
- rootCmd.PersistentFlags().StringVar(&flags.externalURL, "external-url", common.ExternalURLPlaceholder, "the external URL where user visits Bytebase, must start with http:// or https://")
+ rootCmd.PersistentFlags().StringVar(&flags.externalURL, "external-url", "", "the external URL where user visits Bytebase, must start with http:// or https://")
rootCmd.PersistentFlags().StringVar(&flags.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(&flags.readonly, "readonly", false, "whether to run in read-only mode")
+ rootCmd.PersistentFlags().BoolVar(&flags.saas, "saas", false, "whether to run in SaaS mode")
// Must be one of the subpath name in the ./store/demo/ directory
rootCmd.PersistentFlags().StringVar(&flags.demoName, "demo", "", "name of the demo to use. Empty means not running in demo mode.")
rootCmd.PersistentFlags().BoolVar(&flags.debug, "debug", false, "whether to enable debug level logging")
@@ -190,10 +192,13 @@ func start() {
defer log.Sync()
var err error
- flags.externalURL, err = utils.NormalizeExternalURL(flags.externalURL)
- if err != nil {
- log.Error("invalid --external-url", zap.Error(err))
- return
+
+ if flags.externalURL != "" {
+ flags.externalURL, err = common.NormalizeExternalURL(flags.externalURL)
+ if err != nil {
+ log.Error("invalid --external-url", zap.Error(err))
+ return
+ }
}
if err := checkDataDir(); err != nil {
log.Error(err.Error())
@@ -254,7 +259,7 @@ func start() {
}
externalAddr := profile.ExternalURL
- if profile.ExternalURL == common.ExternalURLPlaceholder {
+ if profile.ExternalURL == "" {
externalAddr = fmt.Sprintf("!!! You have not set --external-url. If you want to make Bytebase\n!!! externally accessible, follow:\n\n%s", common.ExternalURLPlaceholder)
}
fmt.Printf(greetingBanner, fmt.Sprintf("Version %s (schema version %v) has started on port %d", profile.Version, s.SchemaVersion, flags.port), externalAddr)
diff --git a/backend/common/util.go b/backend/common/util.go
index b62e74ba0a..870331c17f 100644
--- a/backend/common/util.go
+++ b/backend/common/util.go
@@ -10,8 +10,11 @@ import (
"path/filepath"
"regexp"
"sort"
+ "strconv"
"strings"
"time"
+
+ "github.com/pkg/errors"
)
const (
@@ -185,3 +188,30 @@ func Unobfuscate(dst, seed string) (string, error) {
}
return string(unobfuscated), nil
}
+
+// NormalizeExternalURL will format the external url.
+func NormalizeExternalURL(url string) (string, error) {
+ r := strings.TrimSpace(url)
+ r = strings.TrimSuffix(r, "/")
+ if !HasPrefixes(r, "http://", "https://") {
+ return "", errors.Errorf("%s must start with http:// or https://", url)
+ }
+ parts := strings.Split(r, ":")
+ if len(parts) > 3 {
+ return "", errors.Errorf("%s malformed", url)
+ }
+ if len(parts) == 3 {
+ port, err := strconv.Atoi(parts[2])
+ if err != nil {
+ return "", errors.Errorf("%s has non integer port", url)
+ }
+ // The external URL is used as the redirectURL in the get token process of OAuth, and the
+ // RedirectURL needs to be consistent with the RedirectURL in the get code process.
+ // The frontend gets it through window.location.origin in the get code
+ // process, so port 80/443 need to be cropped.
+ if port == 80 || port == 443 {
+ r = strings.Join(parts[0:2], ":")
+ }
+ }
+ return r, nil
+}
diff --git a/backend/common/util_test.go b/backend/common/util_test.go
index 17ce588ba7..45b72fab9b 100644
--- a/backend/common/util_test.go
+++ b/backend/common/util_test.go
@@ -159,3 +159,70 @@ func TestObfuscate(t *testing.T) {
require.Equal(t, test.src, ubobfuscated)
}
}
+
+func TestNormalizeExternalURL(t *testing.T) {
+ tests := []struct {
+ url string
+ want string
+ wantErr bool
+ }{
+ {
+ url: "http://localhost:3000",
+ want: "http://localhost:3000",
+ wantErr: false,
+ },
+ {
+ url: "https://localhost:3000",
+ want: "https://localhost:3000",
+ wantErr: false,
+ },
+ {
+ url: "https://localhost",
+ want: "https://localhost",
+ wantErr: false,
+ },
+ {
+ url: "http://localhost:80",
+ want: "http://localhost",
+ wantErr: false,
+ },
+ {
+ url: "https://localhost:443",
+ want: "https://localhost",
+ wantErr: false,
+ },
+ {
+ url: " https://localhost:3000/ ",
+ want: "https://localhost:3000",
+ wantErr: false,
+ },
+ // Missing http:// or https://
+ {
+ url: "localhost:3000",
+ want: "",
+ wantErr: true,
+ },
+ // Invalid port
+ {
+ url: "http://localhost:xxx",
+ want: "",
+ wantErr: true,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.url, func(t *testing.T) {
+ g, err := NormalizeExternalURL(tt.url)
+ if err != nil {
+ if !tt.wantErr {
+ t.Errorf("expect no error, got %s", err.Error())
+ }
+ } else {
+ if tt.wantErr {
+ t.Errorf("expect error")
+ } else if tt.want != g {
+ t.Errorf("expect %s, got %s", tt.want, g)
+ }
+ }
+ })
+ }
+}
diff --git a/backend/component/config/profile.go b/backend/component/config/profile.go
index 54a7b12728..dbff0941df 100644
--- a/backend/component/config/profile.go
+++ b/backend/component/config/profile.go
@@ -29,6 +29,8 @@ type Profile struct {
// - Requests other than GET will be rejected
// - Any operations involving mutation will not start (e.g. Background schema syncer, task scheduler)
Readonly bool
+ // When we are running in SaaS mode, some features are only controlled by use.
+ SaaS bool
// DataDir is the directory stores the data including Bytebase's own database, backups, etc.
DataDir string
// ResourceDir is the directory stores the resources including embedded postgres, mysqlutil, mongoutil and etc.
@@ -72,3 +74,12 @@ type Profile struct {
func (prof *Profile) UseEmbedDB() bool {
return len(prof.PgURL) == 0
}
+
+var saasFeatureControlMap = map[string]bool{
+ string(api.SettingWorkspaceGeneral): true,
+}
+
+// IsFeatureUnavailable returns if the feature is unavailable in SaaS mode.
+func (prof *Profile) IsFeatureUnavailable(feature string) bool {
+ return prof.SaaS && saasFeatureControlMap[feature]
+}
diff --git a/backend/legacyapi/actuator.go b/backend/legacyapi/actuator.go
deleted file mode 100644
index 76acb0549d..0000000000
--- a/backend/legacyapi/actuator.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package api
-
-// ServerInfo is the API message for server info.
-// Actuator concept is similar to the Spring Boot Actuator.
-type ServerInfo struct {
- Version string `json:"version"`
- GitCommit string `json:"gitCommit"`
- Readonly bool `json:"readonly"`
- DemoName string `json:"demoName"`
- Host string `json:"host"`
- Port string `json:"port"`
- ExternalURL string `json:"externalUrl"`
- NeedAdminSetup bool `json:"needAdminSetup"`
- DisallowSignup bool `json:"disallowSignup"`
- // Rand may be based on the server start time, thus exposing startedTs to the client may cause security issues (e.g. jwt key is based on Rand).
- // StartedTs int64 `json:"startedTs"`
-}
diff --git a/backend/server/actuator.go b/backend/server/actuator.go
deleted file mode 100644
index eb33bc5325..0000000000
--- a/backend/server/actuator.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package server
-
-import (
- "net/http"
-
- "github.com/labstack/echo/v4"
-
- api "github.com/bytebase/bytebase/backend/legacyapi"
- "github.com/bytebase/bytebase/backend/store"
-)
-
-func (s *Server) registerActuatorRoutes(g *echo.Group) {
- g.GET("/actuator/info", func(c echo.Context) error {
- ctx := c.Request().Context()
-
- setting, err := s.store.GetWorkspaceGeneralSetting(ctx)
- if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find workspace setting").SetInternal(err)
- }
-
- serverInfo := api.ServerInfo{
- Version: s.profile.Version,
- GitCommit: s.profile.GitCommit,
- Readonly: s.profile.Readonly,
- DemoName: s.profile.DemoName,
- ExternalURL: setting.ExternalUrl,
- DisallowSignup: setting.DisallowSignup,
- }
-
- findRole := api.Owner
- users, err := s.store.ListUsers(ctx, &store.FindUserMessage{Role: &findRole})
- if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch admin setup status").SetInternal(err)
- }
- count := 0
- for _, user := range users {
- if user.ID == api.SystemBotID {
- continue
- }
- count++
- }
- serverInfo.NeedAdminSetup = count == 0
-
- return c.JSON(http.StatusOK, serverInfo)
- })
-}
diff --git a/backend/server/project.go b/backend/server/project.go
index eaad04a2fe..b8a79af8d0 100644
--- a/backend/server/project.go
+++ b/backend/server/project.go
@@ -314,8 +314,8 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
} else {
// Bytebase needs to create a webbook in the connecting repository pointing back to the
// Bytebase address exposed at --external-url.
- if setting.ExternalUrl == common.ExternalURLPlaceholder {
- return echo.NewHTTPError(http.StatusBadRequest, "Bytebase must start with --external-url to configure GitOps workflow")
+ if setting.ExternalUrl == "" {
+ return echo.NewHTTPError(http.StatusBadRequest, "Bytebase must start with --external-url to configure GitOps workflow, docs: %s", common.ExternalURLPlaceholder)
}
repositoryCreate.WebhookEndpointID = fmt.Sprintf("%s-%d", s.workspaceID, time.Now().Unix())
diff --git a/backend/server/server.go b/backend/server/server.go
index 2fe34990b7..ddfcd4c0f4 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -419,7 +419,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
})
s.registerDebugRoutes(apiGroup)
s.registerSettingRoutes(apiGroup)
- s.registerActuatorRoutes(apiGroup)
s.registerAuthRoutes(apiGroup)
s.registerOAuthRoutes(apiGroup)
s.registerPrincipalRoutes(apiGroup)
@@ -470,6 +469,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
}
return nil
}))
+ v1pb.RegisterActuatorServiceServer(s.grpcServer, v1.NewActuatorService(s.store, &s.profile))
v1pb.RegisterEnvironmentServiceServer(s.grpcServer, v1.NewEnvironmentService(s.store, s.licenseService))
v1pb.RegisterInstanceServiceServer(s.grpcServer, v1.NewInstanceService(s.store, s.licenseService, s.secret))
v1pb.RegisterProjectServiceServer(s.grpcServer, v1.NewProjectService(s.store))
@@ -477,7 +477,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
v1pb.RegisterInstanceRoleServiceServer(s.grpcServer, v1.NewInstanceRoleService(s.store, s.dbFactory))
v1pb.RegisterOrgPolicyServiceServer(s.grpcServer, v1.NewOrgPolicyService(s.store, s.licenseService))
v1pb.RegisterIdentityProviderServiceServer(s.grpcServer, v1.NewIdentityProviderService(s.store, s.licenseService))
- v1pb.RegisterSettingServiceServer(s.grpcServer, v1.NewSettingService(s.store))
+ v1pb.RegisterSettingServiceServer(s.grpcServer, v1.NewSettingService(s.store, &s.profile))
v1pb.RegisterAnomalyServiceServer(s.grpcServer, v1.NewAnomalyService(s.store))
reflection.Register(s.grpcServer)
@@ -491,6 +491,9 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
if err := v1pb.RegisterAuthServiceHandler(ctx, mux, grpcConn); err != nil {
return nil, err
}
+ if err := v1pb.RegisterActuatorServiceHandler(ctx, mux, grpcConn); err != nil {
+ return nil, err
+ }
if err := v1pb.RegisterEnvironmentServiceHandler(ctx, mux, grpcConn); err != nil {
return nil, err
}
diff --git a/backend/server/server_frontend_embed.go b/backend/server/server_frontend_embed.go
index aabede4289..4e444d4013 100644
--- a/backend/server/server_frontend_embed.go
+++ b/backend/server/server_frontend_embed.go
@@ -56,7 +56,7 @@ func oauthRedirectURL(externalURL string) string {
}
func oauthErrorMessage(externalURL string) string {
- if externalURL == common.ExternalURLPlaceholder {
+ if externalURL == "" {
return fmt.Sprintf("Failed to exchange OAuth token. You have not configured --external-url, please follow %s", common.ExternalURLPlaceholder)
}
return fmt.Sprintf("Failed to exchange OAuth token. Make sure --external-url %s matches your browser host. Note that if you are not using port 80 or 443, you should also specify the port such as --external-url=http://host:port", externalURL)
diff --git a/backend/server/setting.go b/backend/server/setting.go
index cf97861da0..3a436bdd02 100644
--- a/backend/server/setting.go
+++ b/backend/server/setting.go
@@ -11,7 +11,6 @@ import (
"github.com/bytebase/bytebase/backend/common"
api "github.com/bytebase/bytebase/backend/legacyapi"
"github.com/bytebase/bytebase/backend/plugin/app/feishu"
- "github.com/bytebase/bytebase/backend/utils"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
@@ -60,6 +59,10 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusForbidden, api.FeatureBranding.AccessErrorMessage())
}
+ if s.profile.IsFeatureUnavailable(string(settingPatch.Name)) {
+ return echo.NewHTTPError(http.StatusBadRequest, "Feature %v is unavailable in current mode", settingPatch.Name)
+ }
+
if err := jsonapi.UnmarshalPayload(c.Request().Body, settingPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformed update setting request").SetInternal(err)
}
@@ -69,7 +72,7 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {
if err := json.Unmarshal([]byte(settingPatch.Value), payload); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal setting value").SetInternal(err)
}
- externalURL, err := utils.NormalizeExternalURL(payload.ExternalUrl)
+ externalURL, err := common.NormalizeExternalURL(payload.ExternalUrl)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Invalid external url").SetInternal(err)
}
diff --git a/backend/utils/utils.go b/backend/utils/utils.go
index 2c721403f6..c78f5ef603 100644
--- a/backend/utils/utils.go
+++ b/backend/utils/utils.go
@@ -467,30 +467,3 @@ func passCheck(taskCheckRunList []*store.TaskCheckRunMessage, checkType api.Task
return true, nil
}
-
-// NormalizeExternalURL will format the external url.
-func NormalizeExternalURL(url string) (string, error) {
- r := strings.TrimSpace(url)
- r = strings.TrimSuffix(r, "/")
- if !common.HasPrefixes(r, "http://", "https://") {
- return "", errors.Errorf("%s must start with http:// or https://", url)
- }
- parts := strings.Split(r, ":")
- if len(parts) > 3 {
- return "", errors.Errorf("%s malformed", url)
- }
- if len(parts) == 3 {
- port, err := strconv.Atoi(parts[2])
- if err != nil {
- return "", errors.Errorf("%s has non integer port", url)
- }
- // The external URL is used as the redirectURL in the get token process of OAuth, and the
- // RedirectURL needs to be consistent with the RedirectURL in the get code process.
- // The frontend gets it through window.location.origin in the get code
- // process, so port 80/443 need to be cropped.
- if port == 80 || port == 443 {
- r = strings.Join(parts[0:2], ":")
- }
- }
- return r, nil
-}
diff --git a/backend/utils/utils_test.go b/backend/utils/utils_test.go
index ea55af80d9..09bff6fa70 100644
--- a/backend/utils/utils_test.go
+++ b/backend/utils/utils_test.go
@@ -364,70 +364,3 @@ func TestMergeTaskCreateLists(t *testing.T) {
})
}
}
-
-func TestNormalizeExternalURL(t *testing.T) {
- tests := []struct {
- url string
- want string
- wantErr bool
- }{
- {
- url: "http://localhost:3000",
- want: "http://localhost:3000",
- wantErr: false,
- },
- {
- url: "https://localhost:3000",
- want: "https://localhost:3000",
- wantErr: false,
- },
- {
- url: "https://localhost",
- want: "https://localhost",
- wantErr: false,
- },
- {
- url: "http://localhost:80",
- want: "http://localhost",
- wantErr: false,
- },
- {
- url: "https://localhost:443",
- want: "https://localhost",
- wantErr: false,
- },
- {
- url: " https://localhost:3000/ ",
- want: "https://localhost:3000",
- wantErr: false,
- },
- // Missing http:// or https://
- {
- url: "localhost:3000",
- want: "",
- wantErr: true,
- },
- // Invalid port
- {
- url: "http://localhost:xxx",
- want: "",
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.url, func(t *testing.T) {
- g, err := NormalizeExternalURL(tt.url)
- if err != nil {
- if !tt.wantErr {
- t.Errorf("expect no error, got %s", err.Error())
- }
- } else {
- if tt.wantErr {
- t.Errorf("expect error")
- } else if tt.want != g {
- t.Errorf("expect %s, got %s", tt.want, g)
- }
- }
- })
- }
-}
diff --git a/frontend/src/components/GeneralSetting/SecuritySetting.vue b/frontend/src/components/GeneralSetting/SecuritySetting.vue
index 5456729e42..fd711c8988 100644
--- a/frontend/src/components/GeneralSetting/SecuritySetting.vue
+++ b/frontend/src/components/GeneralSetting/SecuritySetting.vue
@@ -36,7 +36,7 @@
{{ $t("settings.general.workspace.watermark.description") }}
</div>
</div>
- <div class="mb-7 mt-5 lg:mt-0">
+ <div v-if="!isSaaSMode" class="mb-7 mt-5 lg:mt-0">
<label
class="flex items-center gap-x-2 tooltip-wrapper"
:class="[allowEdit ? 'cursor-pointer' : 'cursor-not-allowed']"
@@ -77,12 +77,14 @@
<script lang="ts" setup>
import { computed, reactive } from "vue";
+import { storeToRefs } from "pinia";
import {
featureToRef,
pushNotification,
useCurrentUser,
useSettingByName,
useSettingStore,
+ useActuatorStore,
} from "@/store";
import { BBCheckbox } from "@/bbkit";
import { hasWorkspacePermission } from "@/utils";
@@ -98,6 +100,9 @@ const state = reactive<LocalState>({
const { t } = useI18n();
const settingStore = useSettingStore();
const currentUser = useCurrentUser();
+const actuatorStore = useActuatorStore();
+
+const { isSaaSMode } = storeToRefs(actuatorStore);
const hasWatermarkFeature = featureToRef("bb.feature.branding");
const watermarkSetting = useSettingByName("bb.workspace.watermark");
@@ -113,6 +118,7 @@ const watermarkEnabled = computed((): boolean => {
const disallowSignupEnabled = computed((): boolean => {
return settingStore.workspaceSetting?.disallowSignup ?? false;
});
+
const handleDisallowSignupToggle = async (on: boolean) => {
const payload: WorkspaceGeneralSettingPayload = {
disallowSignup: settingStore.workspaceSetting?.disallowSignup ?? false,
diff --git a/frontend/src/plugins/demo/index.ts b/frontend/src/plugins/demo/index.ts
index d14522b649..1b5d66a34d 100644
--- a/frontend/src/plugins/demo/index.ts
+++ b/frontend/src/plugins/demo/index.ts
@@ -44,7 +44,7 @@ const mountDemoApp = async () => {
await axios.get<{
demoName: string;
version: string;
- }>(`/api/actuator/info`)
+ }>(`/v1/actuator/info`)
).data;
// only show feature demo if it's not the default demo.
diff --git a/frontend/src/store/modules/actuator.ts b/frontend/src/store/modules/actuator.ts
index b76396d607..a4c070e394 100644
--- a/frontend/src/store/modules/actuator.ts
+++ b/frontend/src/store/modules/actuator.ts
@@ -33,11 +33,15 @@ export const useActuatorStore = defineStore("actuator", {
isReadonly: (state) => {
return state.serverInfo?.readonly || false;
},
+ isSaaSMode: (state) => {
+ return state.serverInfo?.saas || false;
+ },
needAdminSetup: (state) => {
return state.serverInfo?.needAdminSetup || false;
},
needConfigureExternalUrl: (state) => {
- return state.serverInfo?.externalUrl === EXTERNAL_URL_PLACEHOLDER;
+ const url = state.serverInfo?.externalUrl ?? "";
+ return url === "" || url === EXTERNAL_URL_PLACEHOLDER;
},
disallowSignup: (state) => {
return state.serverInfo?.disallowSignup || false;
@@ -58,8 +62,9 @@ export const useActuatorStore = defineStore("actuator", {
this.serverInfo = serverInfo;
},
async fetchServerInfo() {
- const serverInfo = (await axios.get(`/api/actuator/info`))
- .data as ServerInfo;
+ const { data: serverInfo } = await axios.get<ServerInfo>(
+ `/v1/actuator/info`
+ );
this.setServerInfo(serverInfo);
diff --git a/frontend/src/types/actuator.ts b/frontend/src/types/actuator.ts
index dbb7504e07..05e1c4eda6 100644
--- a/frontend/src/types/actuator.ts
+++ b/frontend/src/types/actuator.ts
@@ -2,6 +2,7 @@ export type ServerInfo = {
version: string;
gitCommit: string;
readonly: boolean;
+ saas: boolean;
demoName: string;
externalUrl: string;
needAdminSetup: boolean;
diff --git a/frontend/src/types/proto/v1/actuator_service.ts b/frontend/src/types/proto/v1/actuator_service.ts
new file mode 100644
index 0000000000..061b9f22c7
--- /dev/null
+++ b/frontend/src/types/proto/v1/actuator_service.ts
@@ -0,0 +1,242 @@
+/* eslint-disable */
+import type { CallContext, CallOptions } from "nice-grpc-common";
+import * as _m0 from "protobufjs/minimal";
+
+export const protobufPackage = "bytebase.v1";
+
+export interface GetActuatorInfoRequest {
+}
+
+export interface ActuatorInfo {
+ version: string;
+ gitCommit: string;
+ readonly: boolean;
+ saas: boolean;
+ demoName: string;
+ host: string;
+ port: string;
+ externalUrl: string;
+ needAdminSetup: boolean;
+ disallowSignup: boolean;
+}
+
+function createBaseGetActuatorInfoRequest(): GetActuatorInfoRequest {
+ return {};
+}
+
+export const GetActuatorInfoRequest = {
+ encode(_: GetActuatorInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetActuatorInfoRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetActuatorInfoRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(_: any): GetActuatorInfoRequest {
+ return {};
+ },
+
+ toJSON(_: GetActuatorInfoRequest): unknown {
+ const obj: any = {};
+ return obj;
+ },
+
+ fromPartial(_: DeepPartial<GetActuatorInfoRequest>): GetActuatorInfoRequest {
+ const message = createBaseGetActuatorInfoRequest();
+ return message;
+ },
+};
+
+function createBaseActuatorInfo(): ActuatorInfo {
+ return {
+ version: "",
+ gitCommit: "",
+ readonly: false,
+ saas: false,
+ demoName: "",
+ host: "",
+ port: "",
+ externalUrl: "",
+ needAdminSetup: false,
+ disallowSignup: false,
+ };
+}
+
+export const ActuatorInfo = {
+ encode(message: ActuatorInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.version !== "") {
+ writer.uint32(10).string(message.version);
+ }
+ if (message.gitCommit !== "") {
+ writer.uint32(18).string(message.gitCommit);
+ }
+ if (message.readonly === true) {
+ writer.uint32(24).bool(message.readonly);
+ }
+ if (message.saas === true) {
+ writer.uint32(32).bool(message.saas);
+ }
+ if (message.demoName !== "") {
+ writer.uint32(42).string(message.demoName);
+ }
+ if (message.host !== "") {
+ writer.uint32(50).string(message.host);
+ }
+ if (message.port !== "") {
+ writer.uint32(58).string(message.port);
+ }
+ if (message.externalUrl !== "") {
+ writer.uint32(66).string(message.externalUrl);
+ }
+ if (message.needAdminSetup === true) {
+ writer.uint32(72).bool(message.needAdminSetup);
+ }
+ if (message.disallowSignup === true) {
+ writer.uint32(80).bool(message.disallowSignup);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ActuatorInfo {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseActuatorInfo();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.version = reader.string();
+ break;
+ case 2:
+ message.gitCommit = reader.string();
+ break;
+ case 3:
+ message.readonly = reader.bool();
+ break;
+ case 4:
+ message.saas = reader.bool();
+ break;
+ case 5:
+ message.demoName = reader.string();
+ break;
+ case 6:
+ message.host = reader.string();
+ break;
+ case 7:
+ message.port = reader.string();
+ break;
+ case 8:
+ message.externalUrl = reader.string();
+ break;
+ case 9:
+ message.needAdminSetup = reader.bool();
+ break;
+ case 10:
+ message.disallowSignup = reader.bool();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): ActuatorInfo {
+ return {
+ version: isSet(object.version) ? String(object.version) : "",
+ gitCommit: isSet(object.gitCommit) ? String(object.gitCommit) : "",
+ readonly: isSet(object.readonly) ? Boolean(object.readonly) : false,
+ saas: isSet(object.saas) ? Boolean(object.saas) : false,
+ demoName: isSet(object.demoName) ? String(object.demoName) : "",
+ host: isSet(object.host) ? String(object.host) : "",
+ port: isSet(object.port) ? String(object.port) : "",
+ externalUrl: isSet(object.externalUrl) ? String(object.externalUrl) : "",
+ needAdminSetup: isSet(object.needAdminSetup) ? Boolean(object.needAdminSetup) : false,
+ disallowSignup: isSet(object.disallowSignup) ? Boolean(object.disallowSignup) : false,
+ };
+ },
+
+ toJSON(message: ActuatorInfo): unknown {
+ const obj: any = {};
+ message.version !== undefined && (obj.version = message.version);
+ message.gitCommit !== undefined && (obj.gitCommit = message.gitCommit);
+ message.readonly !== undefined && (obj.readonly = message.readonly);
+ message.saas !== undefined && (obj.saas = message.saas);
+ message.demoName !== undefined && (obj.demoName = message.demoName);
+ message.host !== undefined && (obj.host = message.host);
+ message.port !== undefined && (obj.port = message.port);
+ message.externalUrl !== undefined && (obj.externalUrl = message.externalUrl);
+ message.needAdminSetup !== undefined && (obj.needAdminSetup = message.needAdminSetup);
+ message.disallowSignup !== undefined && (obj.disallowSignup = message.disallowSignup);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<ActuatorInfo>): ActuatorInfo {
+ const message = createBaseActuatorInfo();
+ message.version = object.version ?? "";
+ message.gitCommit = object.gitCommit ?? "";
+ message.readonly = object.readonly ?? false;
+ message.saas = object.saas ?? false;
+ message.demoName = object.demoName ?? "";
+ message.host = object.host ?? "";
+ message.port = object.port ?? "";
+ message.externalUrl = object.externalUrl ?? "";
+ message.needAdminSetup = object.needAdminSetup ?? false;
+ message.disallowSignup = object.disallowSignup ?? false;
+ return message;
+ },
+};
+
+export type ActuatorServiceDefinition = typeof ActuatorServiceDefinition;
+export const ActuatorServiceDefinition = {
+ name: "ActuatorService",
+ fullName: "bytebase.v1.ActuatorService",
+ methods: {
+ getActuatorInfo: {
+ name: "GetActuatorInfo",
+ requestType: GetActuatorInfoRequest,
+ requestStream: false,
+ responseType: ActuatorInfo,
+ responseStream: false,
+ options: {},
+ },
+ },
+} as const;
+
+export interface ActuatorServiceImplementation<CallContextExt = {}> {
+ getActuatorInfo(
+ request: GetActuatorInfoRequest,
+ context: CallContext & CallContextExt,
+ ): Promise<DeepPartial<ActuatorInfo>>;
+}
+
+export interface ActuatorServiceClient<CallOptionsExt = {}> {
+ getActuatorInfo(
+ request: DeepPartial<GetActuatorInfoRequest>,
+ options?: CallOptions & CallOptionsExt,
+ ): Promise<ActuatorInfo>;
+}
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/frontend/src/views/SettingWorkspaceGeneral.vue b/frontend/src/views/SettingWorkspaceGeneral.vue
index 2cdb17b420..48fd9c10e0 100644
--- a/frontend/src/views/SettingWorkspaceGeneral.vue
+++ b/frontend/src/views/SettingWorkspaceGeneral.vue
@@ -2,14 +2,20 @@
<div class="space-y-4 divide-y divide-block-border">
<BrandingSetting />
<SecuritySetting />
- <NetworkSetting />
+ <NetworkSetting v-if="!isSaaSMode" />
</div>
</template>
<script lang="ts" setup>
+import { storeToRefs } from "pinia";
import {
BrandingSetting,
SecuritySetting,
NetworkSetting,
} from "@/components/GeneralSetting";
+import { useActuatorStore } from "@/store";
+
+const actuatorStore = useActuatorStore();
+
+const { isSaaSMode } = storeToRefs(actuatorStore);
</script>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 5c8581628a..f75d9f464f 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -3,6 +3,12 @@
## Table of Contents
+- [v1/actuator_service.proto](#v1_actuator_service-proto)
+ - [ActuatorInfo](#bytebase-v1-ActuatorInfo)
+ - [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest)
+
+ - [ActuatorService](#bytebase-v1-ActuatorService)
+
- [v1/common.proto](#v1_common-proto)
- [Engine](#bytebase-v1-Engine)
- [State](#bytebase-v1-State)
@@ -17,7 +23,7 @@
- [SearchAnomaliesRequest](#bytebase-v1-SearchAnomaliesRequest)
- [SearchAnomaliesResponse](#bytebase-v1-SearchAnomaliesResponse)
- - [Anomaly.AnomalyServerity](#bytebase-v1-Anomaly-AnomalyServerity)
+ - [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity)
- [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType)
- [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule)
@@ -235,6 +241,66 @@
+<a name="v1_actuator_service-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## v1/actuator_service.proto
+
+
+
+<a name="bytebase-v1-ActuatorInfo"></a>
+
+### ActuatorInfo
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| version | [string](#string) | | |
+| git_commit | [string](#string) | | |
+| readonly | [bool](#bool) | | |
+| saas | [bool](#bool) | | |
+| demo_name | [string](#string) | | |
+| host | [string](#string) | | |
+| port | [string](#string) | | |
+| external_url | [string](#string) | | |
+| need_admin_setup | [bool](#bool) | | |
+| disallow_signup | [bool](#bool) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-GetActuatorInfoRequest"></a>
+
+### GetActuatorInfoRequest
+
+
+
+
+
+
+
+
+
+
+
+
+
+<a name="bytebase-v1-ActuatorService"></a>
+
+### ActuatorService
+
+
+| Method Name | Request Type | Response Type | Description |
+| ----------- | ------------ | ------------- | ------------|
+| GetActuatorInfo | [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest) | [ActuatorInfo](#bytebase-v1-ActuatorInfo) | |
+
+
+
+
+
<a name="v1_common-proto"></a>
<p align="right"><a href="#top">Top</a></p>
@@ -301,7 +367,7 @@
| ----- | ---- | ----- | ----------- |
| resource | [string](#string) | | The resource that is the target of the operation. Format: - Instance: environments/{environment}/instnaces/{instance} - Database: environments/{environment}/instnaces/{instance}/databases/{database} |
| type | [Anomaly.AnomalyType](#bytebase-v1-Anomaly-AnomalyType) | | type is the type of the anomaly. |
-| serverity | [Anomaly.AnomalyServerity](#bytebase-v1-Anomaly-AnomalyServerity) | | serverity is the serverity of the anomaly. |
+| severity | [Anomaly.AnomalySeverity](#bytebase-v1-Anomaly-AnomalySeverity) | | severity is the severity of the anomaly. |
| instance_connection_detail | [Anomaly.InstanceConnectionDetail](#bytebase-v1-Anomaly-InstanceConnectionDetail) | | |
| database_connection_detail | [Anomaly.DatabaseConnectionDetail](#bytebase-v1-Anomaly-DatabaseConnectionDetail) | | |
| database_backup_policy_violation_detail | [Anomaly.DatabaseBackupPolicyViolationDetail](#bytebase-v1-Anomaly-DatabaseBackupPolicyViolationDetail) | | |
@@ -322,7 +388,7 @@ DatabaseBackupMissingDetail is the detail for database backup missing anomaly.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| expected_schedule | [Anomaly.BackupPlanSchedule](#bytebase-v1-Anomaly-BackupPlanSchedule) | | expected_schedule is the expected backup plan schedule in the database. |
-| lastest_backup_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | lastest_backup_time is the last backup time in the database. |
+| latest_backup_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | latest_backup_time is the latest backup time in the database. |
@@ -405,7 +471,7 @@ InstanceConnectionDetail is the detail for instance connection anomaly.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| filter | [string](#string) | | filter is the filter to apply on the search anomaly request, follow the [google cel-spec](https://github.com/google/cel-spec) syntax. For example: Search the anomalies of a specific resource: &#39;anomaly.resource_name=&#34;environments/{environemnt}/instances/{instance}&#34;&#39; Search the specified type of anomalies: &#39;anomaly.type=&#34;DATABASE_BACKUP_POLICY_VIOLATION&#34;&#39; |
+| filter | [string](#string) | | filter is the filter to apply on the search anomaly request, follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax. Only support filter by resource and type for now. For example: Search the anomalies of a specific resource: &#39;resource=&#34;environments/{environemnt}/instances/{instance}&#34;.&#39; Search the specified types of anomalies: &#39;type=&#34;DATABASE_BACKUP_POLICY_VIOLATION&#34; | &#34;MIGRATION_SCHEMA&#34;.&#39; |
| page_size | [int32](#int32) | | Not used. The maximum number of anomalies to return. The service may return fewer than this value. If unspecified, at most 50 anomalies will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
| page_token | [string](#string) | | Not used. A page token, received from a previous `SearchAnomalies` call. Provide this to retrieve the subsequent page.
@@ -434,17 +500,17 @@ When paginating, all other parameters provided to `SearchAnomalies` must match t
-<a name="bytebase-v1-Anomaly-AnomalyServerity"></a>
+<a name="bytebase-v1-Anomaly-AnomalySeverity"></a>
-### Anomaly.AnomalyServerity
-AnomalyServerity is the severity of the anomaly.
+### Anomaly.AnomalySeverity
+AnomalySeverity is the severity of the anomaly.
| Name | Number | Description |
| ---- | ------ | ----------- |
-| ANOMALY_SERVERITY_UNSPECIFIED | 0 | Unspecified anomaly serverity. |
-| MEDIUM | 1 | MEDIUM is the info level anomaly serverity. |
-| HIGH | 2 | HIGH is the warning level anomaly serverity. |
-| CRITICAL | 3 | CRITICAL is the critical level anomaly serverity. |
+| ANOMALY_SEVERITY_UNSPECIFIED | 0 | Unspecified anomaly severity. |
+| MEDIUM | 1 | MEDIUM is the info level anomaly severity. |
+| HIGH | 2 | HIGH is the warning level anomaly severity. |
+| CRITICAL | 3 | CRITICAL is the critical level anomaly severity. |
diff --git a/proto/generated-go/v1/actuator_service.pb.go b/proto/generated-go/v1/actuator_service.pb.go
new file mode 100644
index 0000000000..0ca77482ab
--- /dev/null
+++ b/proto/generated-go/v1/actuator_service.pb.go
@@ -0,0 +1,308 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.1
+// protoc (unknown)
+// source: v1/actuator_service.proto
+
+package v1
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ _ "google.golang.org/protobuf/types/known/emptypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type GetActuatorInfoRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *GetActuatorInfoRequest) Reset() {
+ *x = GetActuatorInfoRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_actuator_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetActuatorInfoRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetActuatorInfoRequest) ProtoMessage() {}
+
+func (x *GetActuatorInfoRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_actuator_service_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetActuatorInfoRequest.ProtoReflect.Descriptor instead.
+func (*GetActuatorInfoRequest) Descriptor() ([]byte, []int) {
+ return file_v1_actuator_service_proto_rawDescGZIP(), []int{0}
+}
+
+type ActuatorInfo struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
+ GitCommit string `protobuf:"bytes,2,opt,name=git_commit,json=gitCommit,proto3" json:"git_commit,omitempty"`
+ Readonly bool `protobuf:"varint,3,opt,name=readonly,proto3" json:"readonly,omitempty"`
+ Saas bool `protobuf:"varint,4,opt,name=saas,proto3" json:"saas,omitempty"`
+ DemoName string `protobuf:"bytes,5,opt,name=demo_name,json=demoName,proto3" json:"demo_name,omitempty"`
+ Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host,omitempty"`
+ Port string `protobuf:"bytes,7,opt,name=port,proto3" json:"port,omitempty"`
+ ExternalUrl string `protobuf:"bytes,8,opt,name=external_url,json=externalUrl,proto3" json:"external_url,omitempty"`
+ NeedAdminSetup bool `protobuf:"varint,9,opt,name=need_admin_setup,json=needAdminSetup,proto3" json:"need_admin_setup,omitempty"`
+ DisallowSignup bool `protobuf:"varint,10,opt,name=disallow_signup,json=disallowSignup,proto3" json:"disallow_signup,omitempty"`
+}
+
+func (x *ActuatorInfo) Reset() {
+ *x = ActuatorInfo{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_actuator_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ActuatorInfo) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ActuatorInfo) ProtoMessage() {}
+
+func (x *ActuatorInfo) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_actuator_service_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ActuatorInfo.ProtoReflect.Descriptor instead.
+func (*ActuatorInfo) Descriptor() ([]byte, []int) {
+ return file_v1_actuator_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *ActuatorInfo) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetGitCommit() string {
+ if x != nil {
+ return x.GitCommit
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetReadonly() bool {
+ if x != nil {
+ return x.Readonly
+ }
+ return false
+}
+
+func (x *ActuatorInfo) GetSaas() bool {
+ if x != nil {
+ return x.Saas
+ }
+ return false
+}
+
+func (x *ActuatorInfo) GetDemoName() string {
+ if x != nil {
+ return x.DemoName
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetHost() string {
+ if x != nil {
+ return x.Host
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetPort() string {
+ if x != nil {
+ return x.Port
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetExternalUrl() string {
+ if x != nil {
+ return x.ExternalUrl
+ }
+ return ""
+}
+
+func (x *ActuatorInfo) GetNeedAdminSetup() bool {
+ if x != nil {
+ return x.NeedAdminSetup
+ }
+ return false
+}
+
+func (x *ActuatorInfo) GetDisallowSignup() bool {
+ if x != nil {
+ return x.DisallowSignup
+ }
+ return false
+}
+
+var File_v1_actuator_service_proto protoreflect.FileDescriptor
+
+var file_v1_actuator_service_proto_rawDesc = []byte{
+ 0x0a, 0x19, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x65,
+ 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61,
+ 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
+ 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c,
+ 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
+ 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x18, 0x0a,
+ 0x16, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe8, 0x02, 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x75,
+ 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52,
+ 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0a, 0x67, 0x69, 0x74, 0x5f,
+ 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,
+ 0x01, 0x03, 0x52, 0x09, 0x67, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x20, 0x0a,
+ 0x08, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x42,
+ 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x12,
+ 0x18, 0x0a, 0x04, 0x73, 0x61, 0x61, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x04, 0xe2,
+ 0x41, 0x01, 0x03, 0x52, 0x04, 0x73, 0x61, 0x61, 0x73, 0x12, 0x21, 0x0a, 0x09, 0x64, 0x65, 0x6d,
+ 0x6f, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41,
+ 0x01, 0x03, 0x52, 0x08, 0x64, 0x65, 0x6d, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x04,
+ 0x68, 0x6f, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03,
+ 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x07,
+ 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74,
+ 0x12, 0x27, 0x0a, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x75, 0x72, 0x6c,
+ 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0b, 0x65, 0x78,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x55, 0x72, 0x6c, 0x12, 0x2e, 0x0a, 0x10, 0x6e, 0x65, 0x65,
+ 0x64, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x65, 0x74, 0x75, 0x70, 0x18, 0x09, 0x20,
+ 0x01, 0x28, 0x08, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0e, 0x6e, 0x65, 0x65, 0x64, 0x41,
+ 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x75, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73,
+ 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x75, 0x70, 0x18, 0x0a, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x69, 0x67, 0x6e,
+ 0x75, 0x70, 0x32, 0x82, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x53,
+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74,
+ 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x74, 0x75, 0x61,
+ 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74,
+ 0x75, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x1c, 0xda, 0x41, 0x00, 0x82, 0xd3,
+ 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x74,
+ 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,
+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_v1_actuator_service_proto_rawDescOnce sync.Once
+ file_v1_actuator_service_proto_rawDescData = file_v1_actuator_service_proto_rawDesc
+)
+
+func file_v1_actuator_service_proto_rawDescGZIP() []byte {
+ file_v1_actuator_service_proto_rawDescOnce.Do(func() {
+ file_v1_actuator_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_actuator_service_proto_rawDescData)
+ })
+ return file_v1_actuator_service_proto_rawDescData
+}
+
+var file_v1_actuator_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_v1_actuator_service_proto_goTypes = []interface{}{
+ (*GetActuatorInfoRequest)(nil), // 0: bytebase.v1.GetActuatorInfoRequest
+ (*ActuatorInfo)(nil), // 1: bytebase.v1.ActuatorInfo
+}
+var file_v1_actuator_service_proto_depIdxs = []int32{
+ 0, // 0: bytebase.v1.ActuatorService.GetActuatorInfo:input_type -> bytebase.v1.GetActuatorInfoRequest
+ 1, // 1: bytebase.v1.ActuatorService.GetActuatorInfo:output_type -> bytebase.v1.ActuatorInfo
+ 1, // [1:2] is the sub-list for method output_type
+ 0, // [0:1] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_v1_actuator_service_proto_init() }
+func file_v1_actuator_service_proto_init() {
+ if File_v1_actuator_service_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_v1_actuator_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetActuatorInfoRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_actuator_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ActuatorInfo); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_v1_actuator_service_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 2,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_v1_actuator_service_proto_goTypes,
+ DependencyIndexes: file_v1_actuator_service_proto_depIdxs,
+ MessageInfos: file_v1_actuator_service_proto_msgTypes,
+ }.Build()
+ File_v1_actuator_service_proto = out.File
+ file_v1_actuator_service_proto_rawDesc = nil
+ file_v1_actuator_service_proto_goTypes = nil
+ file_v1_actuator_service_proto_depIdxs = nil
+}
diff --git a/proto/generated-go/v1/actuator_service.pb.gw.go b/proto/generated-go/v1/actuator_service.pb.gw.go
new file mode 100644
index 0000000000..8f060eebfc
--- /dev/null
+++ b/proto/generated-go/v1/actuator_service.pb.gw.go
@@ -0,0 +1,155 @@
+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
+// source: v1/actuator_service.proto
+
+/*
+Package v1 is a reverse proxy.
+
+It translates gRPC into RESTful JSON APIs.
+*/
+package v1
+
+import (
+ "context"
+ "io"
+ "net/http"
+
+ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/grpclog"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+)
+
+// Suppress "imported and not used" errors
+var _ codes.Code
+var _ io.Reader
+var _ status.Status
+var _ = runtime.String
+var _ = utilities.NewDoubleArray
+var _ = metadata.Join
+
+func request_ActuatorService_GetActuatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, client ActuatorServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq GetActuatorInfoRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := client.GetActuatorInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_ActuatorService_GetActuatorInfo_0(ctx context.Context, marshaler runtime.Marshaler, server ActuatorServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq GetActuatorInfoRequest
+ var metadata runtime.ServerMetadata
+
+ msg, err := server.GetActuatorInfo(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+// RegisterActuatorServiceHandlerServer registers the http handlers for service ActuatorService to "mux".
+// UnaryRPC :call ActuatorServiceServer directly.
+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterActuatorServiceHandlerFromEndpoint instead.
+func RegisterActuatorServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ActuatorServiceServer) error {
+
+ mux.Handle("GET", pattern_ActuatorService_GetActuatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.ActuatorService/GetActuatorInfo", runtime.WithHTTPPathPattern("/v1/actuator/info"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ActuatorService_GetActuatorInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_ActuatorService_GetActuatorInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+// RegisterActuatorServiceHandlerFromEndpoint is same as RegisterActuatorServiceHandler but
+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
+func RegisterActuatorServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+ conn, err := grpc.Dial(endpoint, opts...)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ return
+ }
+ go func() {
+ <-ctx.Done()
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ }()
+ }()
+
+ return RegisterActuatorServiceHandler(ctx, mux, conn)
+}
+
+// RegisterActuatorServiceHandler registers the http handlers for service ActuatorService to "mux".
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterActuatorServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterActuatorServiceHandlerClient(ctx, mux, NewActuatorServiceClient(conn))
+}
+
+// RegisterActuatorServiceHandlerClient registers the http handlers for service ActuatorService
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ActuatorServiceClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ActuatorServiceClient"
+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
+// "ActuatorServiceClient" to call the correct interceptors.
+func RegisterActuatorServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ActuatorServiceClient) error {
+
+ mux.Handle("GET", pattern_ActuatorService_GetActuatorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.ActuatorService/GetActuatorInfo", runtime.WithHTTPPathPattern("/v1/actuator/info"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ActuatorService_GetActuatorInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_ActuatorService_GetActuatorInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+var (
+ pattern_ActuatorService_GetActuatorInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "actuator", "info"}, ""))
+)
+
+var (
+ forward_ActuatorService_GetActuatorInfo_0 = runtime.ForwardResponseMessage
+)
diff --git a/proto/generated-go/v1/actuator_service_grpc.pb.go b/proto/generated-go/v1/actuator_service_grpc.pb.go
new file mode 100644
index 0000000000..120be4c3f5
--- /dev/null
+++ b/proto/generated-go/v1/actuator_service_grpc.pb.go
@@ -0,0 +1,105 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc (unknown)
+// source: v1/actuator_service.proto
+
+package v1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// ActuatorServiceClient is the client API for ActuatorService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ActuatorServiceClient interface {
+ GetActuatorInfo(ctx context.Context, in *GetActuatorInfoRequest, opts ...grpc.CallOption) (*ActuatorInfo, error)
+}
+
+type actuatorServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewActuatorServiceClient(cc grpc.ClientConnInterface) ActuatorServiceClient {
+ return &actuatorServiceClient{cc}
+}
+
+func (c *actuatorServiceClient) GetActuatorInfo(ctx context.Context, in *GetActuatorInfoRequest, opts ...grpc.CallOption) (*ActuatorInfo, error) {
+ out := new(ActuatorInfo)
+ err := c.cc.Invoke(ctx, "/bytebase.v1.ActuatorService/GetActuatorInfo", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ActuatorServiceServer is the server API for ActuatorService service.
+// All implementations must embed UnimplementedActuatorServiceServer
+// for forward compatibility
+type ActuatorServiceServer interface {
+ GetActuatorInfo(context.Context, *GetActuatorInfoRequest) (*ActuatorInfo, error)
+ mustEmbedUnimplementedActuatorServiceServer()
+}
+
+// UnimplementedActuatorServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedActuatorServiceServer struct {
+}
+
+func (UnimplementedActuatorServiceServer) GetActuatorInfo(context.Context, *GetActuatorInfoRequest) (*ActuatorInfo, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetActuatorInfo not implemented")
+}
+func (UnimplementedActuatorServiceServer) mustEmbedUnimplementedActuatorServiceServer() {}
+
+// UnsafeActuatorServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ActuatorServiceServer will
+// result in compilation errors.
+type UnsafeActuatorServiceServer interface {
+ mustEmbedUnimplementedActuatorServiceServer()
+}
+
+func RegisterActuatorServiceServer(s grpc.ServiceRegistrar, srv ActuatorServiceServer) {
+ s.RegisterService(&ActuatorService_ServiceDesc, srv)
+}
+
+func _ActuatorService_GetActuatorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetActuatorInfoRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ActuatorServiceServer).GetActuatorInfo(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/bytebase.v1.ActuatorService/GetActuatorInfo",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ActuatorServiceServer).GetActuatorInfo(ctx, req.(*GetActuatorInfoRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// ActuatorService_ServiceDesc is the grpc.ServiceDesc for ActuatorService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ActuatorService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "bytebase.v1.ActuatorService",
+ HandlerType: (*ActuatorServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "GetActuatorInfo",
+ Handler: _ActuatorService_GetActuatorInfo_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "v1/actuator_service.proto",
+}
diff --git a/proto/v1/actuator_service.proto b/proto/v1/actuator_service.proto
new file mode 100644
index 0000000000..9b7d312a9a
--- /dev/null
+++ b/proto/v1/actuator_service.proto
@@ -0,0 +1,46 @@
+syntax = "proto3";
+
+package bytebase.v1;
+
+import "google/api/annotations.proto";
+import "google/api/client.proto";
+import "google/api/field_behavior.proto";
+import "google/protobuf/empty.proto";
+
+option go_package = "generated-go/v1";
+
+service ActuatorService {
+ rpc GetActuatorInfo(GetActuatorInfoRequest) returns (ActuatorInfo) {
+ option (google.api.http) = {
+ get: "/v1/actuator/info"
+ };
+ option (google.api.method_signature) = "";
+ }
+}
+
+message GetActuatorInfoRequest {
+}
+
+// ServerInfo is the API message for server info.
+// Actuator concept is similar to the Spring Boot Actuator.
+message ActuatorInfo {
+ string version = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ string git_commit = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ bool readonly = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ bool saas = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ string demo_name = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ string host = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ string port = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ string external_url = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ bool need_admin_setup = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ bool disallow_signup = 10;
+}
\ No newline at end of file