server

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: LGPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() (string, error)

Types

type Config

type Config struct {
	Fs      *FSConfig      `json:"fs" yaml:"fs"`
	Secrets *Secrets       `json:"secrets" yaml:"secrets"`
	Server  *ServerCfg     `json:"server" yaml:"server"`
	Users   *UsersCfg      `json:"users" yaml:"users"`
	Workers *WorkerPoolCfg `json:"workers" yaml:"workers"`
}

func NewConfig

func NewConfig() *Config

type FSConfig

type FSConfig struct {
	Root       string `json:"root"`
	OpensLimit int    `json:"opensLimit"`
	OpenTTL    int    `json:"openTTL"`
}

type Secrets

type Secrets struct {
	TokenSecret string `json:"tokenSecret" yaml:"tokenSecret" cfg:"env"`
}

type Server

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

func NewServer

func NewServer(cfg gocfg.ICfg) (*Server, error)

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start() error

type ServerCfg

type ServerCfg struct {
	Debug          bool   `json:"debug" yaml:"debug"`
	Host           string `json:"host" yaml:"host"`
	Port           int    `json:"port" yaml:"port" cfg:"env"`
	ReadTimeout    int    `json:"readTimeout" yaml:"readTimeout"`
	WriteTimeout   int    `json:"writeTimeout" yaml:"writeTimeout"`
	MaxHeaderBytes int    `json:"maxHeaderBytes" yaml:"maxHeaderBytes"`
	PublicPath     string `json:"publicPath" yaml:"publicPath"`
}

type UsersCfg

type UsersCfg struct {
	EnableAuth         bool                 `json:"enableAuth" yaml:"enableAuth"`
	DefaultAdmin       string               `json:"defaultAdmin" yaml:"defaultAdmin" cfg:"env"`
	DefaultAdminPwd    string               `json:"defaultAdminPwd" yaml:"defaultAdminPwd" cfg:"env"`
	CookieTTL          int                  `json:"cookieTTL" yaml:"cookieTTL"`
	CookieSecure       bool                 `json:"cookieSecure" yaml:"cookieSecure"`
	CookieHttpOnly     bool                 `json:"cookieHttpOnly" yaml:"cookieHttpOnly"`
	MinUserNameLen     int                  `json:"minUserNameLen" yaml:"minUserNameLen"`
	MinPwdLen          int                  `json:"minPwdLen" yaml:"minPwdLen"`
	CaptchaWidth       int                  `json:"captchaWidth" yaml:"captchaWidth"`
	CaptchaHeight      int                  `json:"captchaHeight" yaml:"captchaHeight"`
	CaptchaEnabled     bool                 `json:"captchaEnabled" yaml:"captchaEnabled"`
	UploadSpeedLimit   int                  `json:"uploadSpeedLimit" yaml:"uploadSpeedLimit"`
	DownloadSpeedLimit int                  `json:"downloadSpeedLimit" yaml:"downloadSpeedLimit"`
	SpaceLimit         int                  `json:"spaceLimit" yaml:"spaceLimit"`
	LimiterCapacity    int                  `json:"limiterCapacity" yaml:"limiterCapacity"`
	LimiterCyc         int                  `json:"limiterCyc" yaml:"limiterCyc"`
	PredefinedUsers    []*userstore.UserCfg `json:"predefinedUsers" yaml:"predefinedUsers"`
}

type WorkerPoolCfg

type WorkerPoolCfg struct {
	QueueSize   int `json:"queueSize" yaml:"queueSize"`
	SleepCyc    int `json:"sleepCyc" yaml:"sleepCyc"`
	WorkerCount int `json:"workerCount" yaml:"workerCount"`
}

Jump to

Keyboard shortcuts

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