packages

package
v0.0.0-...-f9e74e4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStruct

type ConfigStruct struct {
	gorm.Model
	//global -> статичный сегмент
	TemplatePath          string        `yaml:"templatepath"`
	TemplateDebug         bool          `yaml:"templatedebug"`
	TemplateDebugFatal    bool          `yaml:"teamplatedebugfatal"`
	AdressHTTP            string        `yaml:"adresshttp"`
	ReadTimeout           time.Duration `yaml:"readtimeout"`
	WriteTimeout          time.Duration `yaml:"writetimeout"`
	CertFile              string        `yaml:"certfile"`
	KeyFile               string        `yaml:"keyfile"`
	RedirectTrailingSlash bool          `yaml:"redirecttrailingslash"`
	RedirectFixedPath     bool          `yaml:"redirectfixedpath"`
	//Logging -> статичный сегмент
	Logfile        string        `yaml:"logfile"`
	LogTagsyslog   string        `yaml:"logtagsyslog"`
	LogPrefix      string        `yaml:"logprefix"`
	StaticPath     string        `yaml:"staticfile"`
	StaticPrefix   string        `yaml:"staticprefix"`
	FileTimerSleep time.Duration `yaml:"filetimersleep"`
	//roles
	Roles      []string `yaml:"roles"`
	RolesAdmin []string `yaml:"rolesadmin"`

	//database sqlite (hdd + ramfs)
	DBSQLiteHDD         string        `yaml:"dbsqlitehdd"`
	DBSQLiteRAM         string        `yaml:"dbsqliteram"`
	DBSqliteTimerBackup time.Duration `yaml:"dbsqlitetimer"`

	//sitemap + default category + post links
	Hostname        string `yaml:"hostname"`
	DefaultCategory string `yaml:"defaultcategory"`

	//database mysql
	DBTypeDB             string `yaml:"dbtypedb"`
	DBHost               string `yaml:"dbhost"`
	DBPort               string `yaml:"dbport"`
	DBUser               string `yaml:"dbuser"`
	DBPassword           string `yaml:"dbpassword"`
	DBDatabase           string `yaml:"dbdatabase"`
	DBSSLMode            bool   `yaml:"dbsslmode"`
	DBSetMaxIdleConns    int    `yaml:"dbsetmaxidleconns"`
	DBSetMaxOpenConns    int    `yaml:"dbsetmaxopenconns"`
	DBSetConnMaxLifetime int    `yaml:"dbsetconnmaxlifetime"`
	//project
	PaginateCountOnPage int           `yaml:"paginatecountonpage"`
	PaginateCountLinks  int           `yaml:"paginatecountlinks"`
	PaginateSortType    []string      `yaml:"paginatesorttype"`
	PaginateDebug       bool          `yaml:"paginatedebug"`
	UploadPath          string        `yaml:"uploadpath"`
	SitemapPath         string        `yaml:"sitemappath"`
	SitemapHost         string        `yaml:"sitemaphost"`
	HostFullPathHTTP    string        `yaml:"hostfullpathhttp"`
	HostFullPathHTTPS   string        `yaml:"hostfullpathhttps"`
	SeoTitle            string        `yaml:"seotitle"`
	SeoDesc             string        `yaml:"seodesc"`
	SeoKeys             string        `yaml:"seokeys"`
	SeoRobot            string        `yaml:"seorobot"`
	LaterPostTimePeriod time.Duration `yaml:"laterposttimeperiod"`
	//session
	MailTo         string `yaml:"mailto"`
	MailFrom       string `yaml:"mailfrom"`
	MailHost       string `yaml:"mailhost"`
	MailPort       int    `yaml:"mailport"`
	MailUsername   string `yaml:"mailusername"`
	MailPassword   string `yaml:"mailpassword"`
	CSRFTimeActive int    `yaml:"csrftimeactive"`
	CSRFSalt       string `yaml:"csrfsalt"`
	//Cookie part
	CookieName             string        `yaml:"cookiename"`
	CookieDomain           string        `yaml:"cookiedomain"`
	CookieExpired          int64         `yaml:"cookieexpired"`
	CookieSalt             string        `yaml:"cookiesalt"`
	CookieAnonymous        string        `yaml:"cookieanonymous"`
	CookieRegister         string        `yaml:"cookieregister"`
	RoleDefaultUser        string        `yaml:"roledefaultuser"`
	SessionTime            time.Duration `yaml:"sessiontime"`
	SessionTimeExpired     time.Duration `yaml:"sessiontimeexpired"`
	SessionTimeSave        time.Duration `yaml:"sessiontimesave"`
	SessionPathSave        string        `yaml:"pathsavesession"`
	SessionTimeSleepWorker time.Duration `yaml:"sessiontimesleepworker"`
	TimerTime              time.Duration `yaml:"timertime"`
	SleepTimeCatcher       time.Duration `yaml:"sleeptimecatcher"`
	DeferPostSleepTime     time.Duration `yaml:"deferpostsleeptime"`
	DeferPostTime          time.Duration `yaml:"deferposttime"`
	ContactReview          []string      `yaml:"contactreview"`
	FlashSalt              string        `yaml:"flashsatl"`
	RedisAdress            string        `yaml:"redisadress"`
	RedisDB                int           `yaml:"redisdb"`
	RedisPassword          string        `yaml:"redispassword"`
	DumpConfigFile         string        `yaml:"dumpconfigfile"`
}

---------------------------------------------------------------------- конфигурация -----------------------------------------------------------------------

type Server

type Server struct {
	Mux *chi.Mux

	R *render.Render
	// contains filtered or unexported fields
}

func NewServer

func NewServer(configFile string) *Server

func (*Server) FileServer

func (s *Server) FileServer(r chi.Router, basePath string, path string, root http.FileSystem)

статичные файлы

func (*Server) Handler404

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

404

func (*Server) Handler405

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

405

func (*Server) HandlerRoot

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

root

func (*Server) Run

func (s *Server) Run()

запуск сервера без сертификатов

func (*Server) RunTLS

func (s *Server) RunTLS()

запуск сервера с поддержкой сертификата

Jump to

Keyboard shortcuts

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