web

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 16 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 {
	Port int `env:"SERVER_PORT" envDefault:"8080"`

	// UseEmbed defines whether server should use embedded templates and static files.
	UseEmbed bool `env:"SERVER_USE_EMBED" envDefault:"true"`

	// SkipAuth disables auth. Works only in Debug mode!
	SkipAuth bool `env:"SERVER_SKIP_AUTH"`
	// Credentials is a list of pairs 'login:password' separated by comma.
	// Example: "login:password,user:qwerty"
	Credentials Credentials `env:"SERVER_CREDENTIALS"`

	EnableProfiling bool `env:"SERVER_ENABLE_PROFILING" envDefault:"false"`
}

type Credentials

type Credentials map[string]string

func (*Credentials) UnmarshalText

func (c *Credentials) UnmarshalText(text []byte) error

type Database

type Database interface {
	api.DB
	pages.DB
}

type Server

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

func NewServer

func NewServer(cnf Config, db Database, log logrus.FieldLogger, version, gitHash string) *Server

func (Server) ListenAndServer

func (s Server) ListenAndServer() error

func (*Server) Prepare

func (s *Server) Prepare()

func (Server) Shutdown

func (s Server) Shutdown() error

Directories

Path Synopsis
api
models
Package models contains models of requests and responses
Package models contains models of requests and responses

Jump to

Keyboard shortcuts

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