zitadel/pkg/admin/api/api.go

29 lines
598 B
Go
Raw Normal View History

2020-03-25 09:54:45 +00:00
package api
import (
"context"
2020-03-25 10:17:38 +00:00
grpc_util "github.com/caos/zitadel/internal/api/grpc"
2020-03-25 09:54:45 +00:00
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/caos/zitadel/pkg/admin/api/grpc"
)
type API struct {
grpcServer grpc.Server
gateway grpc.Gateway
}
type Config struct {
2020-03-25 10:17:38 +00:00
GRPC grpc_util.Config
2020-03-25 09:54:45 +00:00
}
func Start(ctx context.Context, conf *Config) error {
api := &API{
2020-03-25 10:17:38 +00:00
grpcServer: *grpc.StartServer(conf.GRPC.ToServerConfig()),
gateway: *grpc.StartGateway(conf.GRPC.ToGatewayConfig()),
2020-03-25 09:54:45 +00:00
}
server.StartServer(ctx, &api.grpcServer)
server.StartGateway(ctx, &api.gateway)
return nil
}