singleprocess

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MPL-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The username of the initial user created during bootstrapping. This
	// also is the user that Waypoint server versions prior to 0.5 used with
	// their token, so we use this to detect that scenario as well.
	DefaultUser = state.DefaultUser

	// The ID of the initial user created during bootstrapping.
	DefaultUserId = state.DefaultUserId

	// The identifier for the default key to use to generating tokens.
	DefaultKeyId = "k1"
)

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid authentication token")
)

Functions

func New

func New(opts ...Option) (pb.WaypointServer, error)

New returns a Waypoint server implementation that uses BotlDB plus in-memory locks to operate safely.

func TestApp

func TestApp(t testing.T, client pb.WaypointClient, ref *pb.Ref_Application)

TestApp creates the app in the DB.

func TestEntrypoint

func TestEntrypoint(t testing.T, client pb.WaypointClient) (string, string, func())

func TestEntrypointPlugin added in v0.3.0

func TestEntrypointPlugin(t testing.T, client pb.WaypointClient) (string, string, func())

func TestImpl

func TestImpl(t testing.T, opts ...Option) pb.WaypointServer

TestImpl returns the waypoint server implementation. This can be used with server.TestServer. It is easier to just use TestServer directly.

func TestRunner

func TestRunner(t testing.T, client pb.WaypointClient, r *pb.Runner) (string, func())

TestRunner registers a runner and returns the ID and a function to deregister the runner. This uses t.Cleanup so that the runner will always be deregistered on test completion.

func TestServer

func TestServer(t testing.T, opts ...Option) pb.WaypointClient

TestServer starts a singleprocess server and returns the connected client. We use t.Cleanup to ensure resources are automatically cleaned up.

Types

type Option

type Option func(*service, *config) error

func TestWithURLService

func TestWithURLService(t testing.T, out *hzntest.DevSetup) Option

TestWithURLService is an Option for testing only that creates an in-memory URL service server. This requires access to an external postgres server.

If out is non-nil, it will be written to with the DevSetup info.

func TestWithURLServiceGuestAccount added in v0.3.0

func TestWithURLServiceGuestAccount(t testing.T) Option

TestWithURLServiceGuestAccount sets the API token to empty to force getting a guest account with the URL service. This can ONLY be set if TestWithURLService is set before this.

func WithAcceptURLTerms

func WithAcceptURLTerms(accept bool) Option

WithAcceptURLTerms will set the config to either accept or reject the terms of service for using the URL service. Rejecting the TOS will disable the URL service. Note that the actual rejection does not occur until the waypoint horizon client attempts to register its guest account.

func WithConfig

func WithConfig(scfg *serverconfig.Config) Option

WithConfig sets the server config in use with this server.

func WithDB

func WithDB(db *bolt.DB) Option

WithDB sets the Bolt DB for use with the server.

func WithLogger

func WithLogger(log hclog.Logger) Option

WithLogger sets the logger for use with the server.

func WithSuperuser added in v0.5.0

func WithSuperuser() Option

WithSuperuser forces all API actions to behave as if a superuser made them. This is usually turned on for local mode only. There is no option (at the time of writing) to enable this on a network-attached server.

Directories

Path Synopsis
Package state manages the state that the singleprocess server has, providing operations to mutate that state safely as needed.
Package state manages the state that the singleprocess server has, providing operations to mutate that state safely as needed.

Jump to

Keyboard shortcuts

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