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" }