api

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugUserOptions

type DebugUserOptions struct {
	Status   DebugUserStatus
	Username string
	Password string
}

DebugUserOptions defines the API debug user options

func (*DebugUserOptions) Prepares

func (opts *DebugUserOptions) Prepares(mode Mode) error

Prepares sets defaults and validates the options

type DebugUserStatus

type DebugUserStatus string

DebugUserStatus defines the debug user status option

const (
	// DebugUserUnset represents the default unset option value
	DebugUserUnset DebugUserStatus = ""

	// DebugUserDisabled disables the debug user
	DebugUserDisabled DebugUserStatus = "disabled"

	// DebugUserReadOnly enables the debug user in a read-only mode
	DebugUserReadOnly DebugUserStatus = "read-only"

	// DebugUserRW enables the debug user in a read-write mode
	DebugUserRW DebugUserStatus = "read-write"
)

type Mode

type Mode string

Mode defines the server mode

const (
	// ModeDebug represents the debug server mode
	ModeDebug Mode = "debug"

	// ModeBeta represents the beta server mode
	ModeBeta Mode = "beta"

	// ModeProduction represents the production server mode
	ModeProduction Mode = "production"
)

type Server

type Server interface {
	// Launche starts the API server and unblocks as soon as the server
	// is running
	Launch() error

	// Shutdown instructs the server to shut down gracefully and blocks until
	// the server is shut down
	Shutdown(context.Context) error

	// AwaitShutdown blocks until the server is shut down
	AwaitShutdown()
}

Server interfaces an API server implementation

func NewServer

func NewServer(opts ServerOptions) (Server, error)

NewServer creates a new API server instance

type ServerOptions

type ServerOptions struct {
	Mode                Mode
	Host                string
	DBHost              string
	SessionKeyGenerator sesskeygen.SessionKeyGenerator
	PasswordHasher      passhash.PasswordHasher
	DebugUser           DebugUserOptions
	Transport           []transport.Server
	ErrorLog            *log.Logger
}

ServerOptions defines the API server options

func (*ServerOptions) Prepare

func (opts *ServerOptions) Prepare() error

Prepare sets defaults and validates the options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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