mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
feat: System api (#3461)
* feat: start system api * feat: remove auth * feat: change gitignore * feat: run system api * feat: remove clear view form admin api * feat: search instances * feat: add instance * fix: set primary domain * Update .gitignore * fix: add instance * fix: add instance * fix: handle errors * fix: handle instance name * fix: test Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
75
internal/api/grpc/system/server.go
Normal file
75
internal/api/grpc/system/server.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/caos/zitadel/internal/admin/repository"
|
||||
http_util "github.com/caos/zitadel/internal/api/http"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/caos/zitadel/internal/admin/repository/eventsourcing"
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/api/grpc/server"
|
||||
"github.com/caos/zitadel/internal/command"
|
||||
"github.com/caos/zitadel/internal/query"
|
||||
"github.com/caos/zitadel/pkg/grpc/system"
|
||||
)
|
||||
|
||||
const (
|
||||
systemAPI = "System-API"
|
||||
)
|
||||
|
||||
var _ system.SystemServiceServer = (*Server)(nil)
|
||||
|
||||
type Server struct {
|
||||
system.UnimplementedSystemServiceServer
|
||||
command *command.Commands
|
||||
query *query.Queries
|
||||
administrator repository.AdministratorRepository
|
||||
DefaultInstance command.InstanceSetup
|
||||
ExternalSecure bool
|
||||
BaseURL string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Repository eventsourcing.Config
|
||||
}
|
||||
|
||||
func CreateServer(command *command.Commands,
|
||||
query *query.Queries,
|
||||
repo repository.Repository,
|
||||
defaultInstance command.InstanceSetup,
|
||||
externalPort uint16,
|
||||
externalDomain string,
|
||||
externalSecure bool) *Server {
|
||||
return &Server{
|
||||
command: command,
|
||||
query: query,
|
||||
administrator: repo,
|
||||
DefaultInstance: defaultInstance,
|
||||
ExternalSecure: externalSecure,
|
||||
BaseURL: http_util.BuildHTTP(externalDomain, externalPort, externalSecure),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) RegisterServer(grpcServer *grpc.Server) {
|
||||
system.RegisterSystemServiceServer(grpcServer, s)
|
||||
}
|
||||
|
||||
func (s *Server) AppName() string {
|
||||
return systemAPI
|
||||
}
|
||||
|
||||
func (s *Server) MethodPrefix() string {
|
||||
return system.SystemService_MethodPrefix
|
||||
}
|
||||
|
||||
func (s *Server) AuthMethods() authz.MethodMapping {
|
||||
return system.SystemService_AuthMethods
|
||||
}
|
||||
|
||||
func (s *Server) RegisterGateway() server.GatewayFunc {
|
||||
return system.RegisterSystemServiceHandlerFromEndpoint
|
||||
}
|
||||
|
||||
func (s *Server) GatewayPathPrefix() string {
|
||||
return "/system/v1"
|
||||
}
|
Reference in New Issue
Block a user