fix configs

This commit is contained in:
Livio Amstutz 2020-03-25 11:17:38 +01:00
parent 8b23c491f9
commit 40734f27c7
9 changed files with 38 additions and 58 deletions

View File

@ -2,6 +2,7 @@ package api
import (
"context"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/caos/zitadel/pkg/admin/api/grpc"
)
@ -12,14 +13,13 @@ type API struct {
}
type Config struct {
GRPCServer grpc.Config
Gateway grpc.GatewayConfig
GRPC grpc_util.Config
}
func Start(ctx context.Context, conf *Config) error {
api := &API{
grpcServer: *grpc.StartServer(conf.GRPCServer),
gateway: *grpc.StartGateway(conf.Gateway),
grpcServer: *grpc.StartServer(conf.GRPC.ToServerConfig()),
gateway: *grpc.StartGateway(conf.GRPC.ToGatewayConfig()),
}
server.StartServer(ctx, &api.grpcServer)
server.StartGateway(ctx, &api.gateway)

View File

@ -1,24 +1,19 @@
package grpc
import (
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"strings"
)
type GatewayConfig struct {
Port string
GRPCEndpoint string
CustomHeaders []string
}
type Gateway struct {
grpcEndpoint string
port string
cutomHeaders []string
}
func StartGateway(conf GatewayConfig) *Gateway {
func StartGateway(conf *grpc_util.GatewayConfig) *Gateway {
return &Gateway{
grpcEndpoint: conf.GRPCEndpoint,
port: conf.Port,

View File

@ -1,9 +1,11 @@
package grpc
import (
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
)
var _ AdminServiceServer = (*Server)(nil)
@ -18,10 +20,9 @@ type Server struct {
searchLimit int
}
func StartServer(conf Config) *Server {
func StartServer(conf *grpc_util.ServerConfig) *Server {
return &Server{
port: conf.Port,
searchLimit: conf.SearchLimit,
port: conf.Port,
}
}

View File

@ -2,6 +2,8 @@ package api
import (
"context"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/caos/zitadel/pkg/auth/api/grpc"
)
@ -12,14 +14,13 @@ type API struct {
}
type Config struct {
GRPCServer grpc.Config
Gateway grpc.GatewayConfig
GRPC grpc_util.Config
}
func Start(ctx context.Context, conf *Config) error {
api := &API{
grpcServer: *grpc.StartServer(conf.GRPCServer),
gateway: *grpc.StartGateway(conf.Gateway),
grpcServer: *grpc.StartServer(conf.GRPC.ToServerConfig()),
gateway: *grpc.StartGateway(conf.GRPC.ToGatewayConfig()),
}
server.StartServer(ctx, &api.grpcServer)
server.StartGateway(ctx, &api.gateway)

View File

@ -1,16 +1,13 @@
package grpc
import (
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"strings"
)
type GatewayConfig struct {
Port string
GRPCEndpoint string
CustomHeaders []string
}
"github.com/grpc-ecosystem/grpc-gateway/runtime"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
)
type Gateway struct {
grpcEndpoint string
@ -18,7 +15,7 @@ type Gateway struct {
cutomHeaders []string
}
func StartGateway(conf GatewayConfig) *Gateway {
func StartGateway(conf *grpc_util.GatewayConfig) *Gateway {
return &Gateway{
grpcEndpoint: conf.GRPCEndpoint,
port: conf.Port,

View File

@ -1,27 +1,23 @@
package grpc
import (
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
)
var _ AuthServiceServer = (*Server)(nil)
type Config struct {
Port string
SearchLimit int
}
type Server struct {
port string
searchLimit int
}
func StartServer(conf Config) *Server {
func StartServer(conf *grpc_util.ServerConfig) *Server {
return &Server{
port: conf.Port,
searchLimit: conf.SearchLimit,
port: conf.Port,
}
}

View File

@ -2,6 +2,8 @@ package api
import (
"context"
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/caos/zitadel/pkg/management/api/grpc"
)
@ -12,14 +14,13 @@ type API struct {
}
type Config struct {
GRPCServer grpc.Config
Gateway grpc.GatewayConfig
GRPC grpc_util.Config
}
func Start(ctx context.Context, conf *Config) error {
api := &API{
grpcServer: *grpc.StartServer(conf.GRPCServer),
gateway: *grpc.StartGateway(conf.Gateway),
grpcServer: *grpc.StartServer(conf.GRPC.ToServerConfig()),
gateway: *grpc.StartGateway(conf.GRPC.ToGatewayConfig()),
}
server.StartServer(ctx, &api.grpcServer)
server.StartGateway(ctx, &api.gateway)

View File

@ -1,24 +1,19 @@
package grpc
import (
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"strings"
)
type GatewayConfig struct {
Port string
GRPCEndpoint string
CustomHeaders []string
}
type Gateway struct {
grpcEndpoint string
port string
cutomHeaders []string
}
func StartGateway(conf GatewayConfig) *Gateway {
func StartGateway(conf *grpc_util.GatewayConfig) *Gateway {
return &Gateway{
grpcEndpoint: conf.GRPCEndpoint,
port: conf.Port,

View File

@ -1,6 +1,7 @@
package grpc
import (
grpc_util "github.com/caos/zitadel/internal/api/grpc"
"github.com/caos/zitadel/internal/api/grpc/server/middleware"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
"google.golang.org/grpc"
@ -8,20 +9,13 @@ import (
var _ ManagementServiceServer = (*Server)(nil)
type Config struct {
Port string
SearchLimit int
}
type Server struct {
port string
searchLimit int
port string
}
func StartServer(conf Config) *Server {
func StartServer(conf *grpc_util.ServerConfig) *Server {
return &Server{
port: conf.Port,
searchLimit: conf.SearchLimit,
port: conf.Port,
}
}