server

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Development bool                    `json:"development,omitempty"`
	HTTP        *httpserver.Config      `json:"http,omitempty"`
	DB          *db.Config              `json:"db,omitempty"`
	SMTP        *smtpserver.Config      `json:"smtp,omitempty"`
	Log         *zap.Config             `json:"log,omitempty"`
	Init        *InitConfig             `json:"init,omitempty"`
	BadActor    *badactorservice.Config `json:"badactor,omitempty"`
	Cleanup     *cleanup.Config         `json:"cleanup,omitempty"`
	Banner      *banner.Config          `json:"banner,omitempty"`
}

Config contains all the configuration options for the server. Everything here should be operator-accessible.

func (*Config) Validate

func (s *Config) Validate() error

Validate validates the the server config and all its sub-server configs are valid.

type InitConfig

type InitConfig struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

InitConfig defines the config needed to bootstrap the initial admin user.

type LoggerService added in v0.1.8

type LoggerService interface {
	Service
	logger.Logger
}

type Server

type Server struct {
	Config             Config
	Info               *letterbox.Info
	DB                 letterbox.Datastore
	HTTP               *httpserver.HTTPService
	SMTP               *smtpserver.SMTPService
	Cleanup            *cleanup.Cleanup
	RegisteredServices []Service
	Hasher             letterbox.ArgonHasher
	Banner             *banner.Builder
}

Server describes the server configuration.

func New

func New(config *Config, i *letterbox.Info) *Server

func (*Server) RegisterService

func (srv *Server) RegisterService(service Service)

func (*Server) Start

func (srv *Server) Start() error

Start initializes a server instance and start the server.

type Service

type Service interface {
	Name() string
	Start() error
	Stop() error
}

Jump to

Keyboard shortcuts

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