2020-03-25 06:58:58 +00:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
ServerPort string
|
|
|
|
GatewayPort string
|
|
|
|
CustomHeaders []string
|
|
|
|
}
|
|
|
|
|
2020-03-27 12:57:16 +00:00
|
|
|
func (c Config) ToServerConfig() ServerConfig {
|
|
|
|
return ServerConfig{
|
2020-03-25 09:41:17 +00:00
|
|
|
Port: c.ServerPort,
|
2020-03-25 06:58:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-27 12:57:16 +00:00
|
|
|
func (c Config) ToGatewayConfig() GatewayConfig {
|
|
|
|
return GatewayConfig{
|
2020-03-25 06:58:58 +00:00
|
|
|
Port: c.GatewayPort,
|
|
|
|
GRPCEndpoint: c.ServerPort,
|
|
|
|
CustomHeaders: c.CustomHeaders,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type ServerConfig struct {
|
2020-03-25 09:41:17 +00:00
|
|
|
Port string
|
2020-03-25 06:58:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type GatewayConfig struct {
|
|
|
|
Port string
|
|
|
|
GRPCEndpoint string
|
|
|
|
CustomHeaders []string
|
|
|
|
}
|