Documentation ¶
Index ¶
- func GetReadyChannel() chan bool
- func GetServerPort() (uint16, error)
- func RunServer(ctx context.Context, grpcPort uint16, port uint16, ...) (err error)
- func StopServer(ctx context.Context)
- type ServerConfigOption
- func WithAdditionalGRPCOpts(opts []grpc.DialOption) ServerConfigOption
- func WithAdditionalHandler(method string, path string, h runtime.HandlerFunc) ServerConfigOption
- func WithAllowedHeaders(headers []string) ServerConfigOption
- func WithAllowedMethods(methods []string) ServerConfigOption
- func WithAllowedOrigins(origins []string) ServerConfigOption
- func WithEmbeddedOAuth2Server(keyPath string, keyPassword string, saveOnCreate bool, ...) ServerConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReadyChannel ¶
func GetReadyChannel() chan bool
GetReadyChannel returns a channel which will notify when the server is ready
func GetServerPort ¶
GetServerPort returns the actual port used by the REST API
func RunServer ¶
func RunServer(ctx context.Context, grpcPort uint16, port uint16, serverOpts ...ServerConfigOption) (err error)
RunServer starts our REST API. The REST API is a reverse proxy using grpc-gateway that exposes certain gRPC calls as RESTful HTTP methods.
func StopServer ¶
StopServer is in charge of stopping the REST API.
Types ¶
type ServerConfigOption ¶
ServerConfigOption represents functional-style options to modify the server configuration in RunServer.
func WithAdditionalGRPCOpts ¶
func WithAdditionalGRPCOpts(opts []grpc.DialOption) ServerConfigOption
WithAdditionalGRPCOpts is an option to add an additional gRPC dial options in the REST server communication to the backend.
func WithAdditionalHandler ¶
func WithAdditionalHandler(method string, path string, h runtime.HandlerFunc) ServerConfigOption
WithAdditionalHandler is an option to add an additional handler func in the REST server.
func WithAllowedHeaders ¶
func WithAllowedHeaders(headers []string) ServerConfigOption
WithAllowedHeaders is an option to supply allowed headers in CORS.
func WithAllowedMethods ¶
func WithAllowedMethods(methods []string) ServerConfigOption
WithAllowedMethods is an option to supply allowed methods in CORS.
func WithAllowedOrigins ¶
func WithAllowedOrigins(origins []string) ServerConfigOption
WithAllowedOrigins is an option to supply allowed origins in CORS.
func WithEmbeddedOAuth2Server ¶
func WithEmbeddedOAuth2Server(keyPath string, keyPassword string, saveOnCreate bool, opts ...oauth2.AuthorizationServerOption) ServerConfigOption
WithEmbeddedOAuth2Server configures our REST gateway to include an embedded OAuth 2.0 authorization server with the given parameters. This server can be used to authenticate and authorize API clients, such as our own micro-services as well as users logging in through the UI.
For the various options to configure the OAuth 2.0 server, please refer to https://pkg.go.dev/github.com/oxisto/oauth2go#AuthorizationServerOption.
In production scenarios, the usage of a dedicated authentication and authorization server is recommended.