server

package
v0.0.0-...-1dc1322 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2023 License: MPL-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GuestLimits = &hznpb.Account_Limits{
		HttpRequests: 5,
		Bandwidth:    1024 / 60.0,
	}
)

Functions

func Run

func Run(opts ...Option) error

Run initializes and starts the server. This will block until the server exits (by cancelling the associated context set with WithContext or due to an unrecoverable error).

func TestGuestAccount

func TestGuestAccount(t testing.T, client pb.WaypointHznClient) grpc.CallOption

TestGuestAccount registers a guest account and returns a context that can be used with auth information for future API calls.

Types

type Option

type Option func(*options)

Option configures Run

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets the context for the server. When this context is cancelled, the server will be shut down.

func WithDB

func WithDB(db *gorm.DB) Option

WithDB sets the DB connection.

func WithDomain

func WithDomain(d string) Option

WithDomain

func WithGRPC

func WithGRPC(ln net.Listener) Option

WithGRPC sets the GRPC listener. This listener must be closed manually by the caller. Prior to closing the listener, it is recommended that you cancel the context set with WithContext and wait for Run to return.

func WithHznControl

func WithHznControl(client hznpb.ControlManagementClient) Option

WithHznControl

func WithLogger

func WithLogger(log hclog.Logger) Option

WithLogger sets the logger.

func WithNamespace

func WithNamespace(ns string) Option

WithNamespace

type TestServerData

type TestServerData struct {
	Addr   string
	Client pb.WaypointHznClient
	Hzn    *hzntest.DevSetup
	// contains filtered or unexported fields
}

func TestServer

func TestServer(t testing.T, opts ...Option) *TestServerData

TestServer starts a server and returns various data such as the client for that server. We use t.Cleanup to ensure resources are automatically cleaned up.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL