server

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerSettings model.ServerSettings

ServerSettings are server settings.

Functions

func InitConfigurationStorage

func InitConfigurationStorage(settings model.ConfigurationStorageSettings, serverConfigPath string) (model.ConfigurationStorage, error)

InitConfigurationStorage initializes configuration storage.

func NewServer

func NewServer(settings model.ServerSettings, db DatabaseComposer, configurationStorage model.ConfigurationStorage, cors *model.CorsOptions, options ...func(*Server) error) (model.Server, error)

NewServer creates backend service.

Types

type Composer

type Composer struct {
	// contains filtered or unexported fields
}

Composer is a service composer which is agnostic to particular database implementations.

func NewComposer

func NewComposer(settings model.ServerSettings, partialComposers []PartialDatabaseComposer, options ...func(*Composer) error) (*Composer, error)

NewComposer returns new database composer based on passed server settings.

func (*Composer) Compose

Compose composes all services.

type DatabaseComposer

type DatabaseComposer interface {
	Compose() (
		model.AppStorage,
		model.UserStorage,
		model.TokenStorage,
		model.TokenBlacklist,
		model.VerificationCodeStorage,
		error,
	)
}

DatabaseComposer inits database stack.

type PartialDatabaseComposer

type PartialDatabaseComposer interface {
	AppStorageComposer() func() (model.AppStorage, error)
	UserStorageComposer() func() (model.UserStorage, error)
	TokenStorageComposer() func() (model.TokenStorage, error)
	TokenBlacklistComposer() func() (model.TokenBlacklist, error)
	VerificationCodeStorageComposer() func() (model.VerificationCodeStorage, error)
}

PartialDatabaseComposer can init services backed with different databases.

type Server

type Server struct {
	MainRouter *web.Router
	// contains filtered or unexported fields
}

Server is a server.

func (*Server) AppStorage

func (s *Server) AppStorage() model.AppStorage

AppStorage returns server's app storage.

func (*Server) Close

func (s *Server) Close()

Close closes all database connections.

func (*Server) ConfigurationStorage

func (s *Server) ConfigurationStorage() model.ConfigurationStorage

ConfigurationStorage returns server's configuration storage.

func (*Server) ImportApps

func (s *Server) ImportApps(filename string) error

ImportApps imports apps from file.

func (*Server) ImportUsers

func (s *Server) ImportUsers(filename string) error

ImportUsers imports users from file.

func (*Server) Router

func (s *Server) Router() model.Router

Router returns server's main router.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) StaticFilesStorage

func (s *Server) StaticFilesStorage() model.StaticFilesStorage

StaticFilesStorage returns server's static files storage.

func (*Server) TokenBlacklist

func (s *Server) TokenBlacklist() model.TokenBlacklist

TokenBlacklist returns server's token blacklist.

func (*Server) TokenStorage

func (s *Server) TokenStorage() model.TokenStorage

TokenStorage returns server's token storage.

func (*Server) UserStorage

func (s *Server) UserStorage() model.UserStorage

UserStorage returns server's user storage.

func (*Server) VerificationCodeStorage

func (s *Server) VerificationCodeStorage() model.VerificationCodeStorage

VerificationCodeStorage returns server's token storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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