cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup struct {
	ServerUrl   string        `` /* 136-byte string literal not displayed */
	AdminPasswd string        `long:"passwd" short:"p" env:"WEB_ADMIN_PASSWD" description:"Пароль пользователя admin."`
	OutFile     string        `` /* 244-byte string literal not displayed */
	Timeout     time.Duration `long:"timeout" short:"t" env:"TIMEOUT" default:"600s" description:"Макс. время выполнения запроса."`
}

func (*Backup) Execute

func (b *Backup) Execute(args []string) error

type EngineType

type EngineType string
var (
	EngineMemory EngineType = "memory"
	EngineBolt   EngineType = "bolt"
)

type ParserType

type ParserType string
var (
	ParserNone       ParserType = "none"
	ParserConsultant ParserType = "consultant"
	ParserSuperJob   ParserType = "superjob"
)

type Server

type Server struct {
	SyncAt      string   `` /* 394-byte string literal not displayed */
	SyncOnStart []string `` /* 435-byte string literal not displayed */

	Web struct {
		Listen      string `` /* 135-byte string literal not displayed */
		AccessLog   bool   `long:"access-log" env:"ACCESS_LOG" description:"Логировать все HTTP-запросы."`
		AdminPasswd string `` /* 130-byte string literal not displayed */

		ReadTimeout       time.Duration `long:"read-timeout" env:"READ_TIMEOUT" value-name:"duration" default:"5s" description:"http.Server ReadTimeout"`
		ReadHeaderTimeout time.Duration `` /* 131-byte string literal not displayed */
		IdleTimeout       time.Duration `long:"idle-timeout" env:"IDLE_TIMEOUT" value-name:"duration" default:"30s" description:"http.Server IdleTimeout"`

		// Запросы к /admin могут выполняться долго, поэтому WriteTimout должен быть достаточно большим.
		WriteTimeout time.Duration `long:"write-timeout" env:"WRITE_TIMEOUT" value-name:"duration" default:"60s" description:"http.Server WriteTimeout"`

		RateLimiter struct {
			ReqLimit    int           `` /* 171-byte string literal not displayed */
			LimitWindow time.Duration `` /* 198-byte string literal not displayed */
		} `group:"Rate Limiter" namespace:"ratelim" env-namespace:"RATE_LIM"`
	} `group:"Web" namespace:"web" env-namespace:"WEB"`

	Store struct {
		Engine EngineType `` /* 189-byte string literal not displayed */

		Bolt struct {
			File string `long:"file" env:"FILE" value-name:"path" default:"cal.bolt" description:"Путь к файлу БД."`
		} `group:"Настройки хранилища bolt" namespace:"bolt" env-namespace:"BOLT"`
	} `group:"Хранилище" namespace:"store" env-namespace:"STORE"`

	Source struct {
		Parser ParserType `` /* 260-byte string literal not displayed */

		Consultant struct {
			Timeout   time.Duration `` /* 165-byte string literal not displayed */
			UserAgent string        `` /* 141-byte string literal not displayed */
		} `group:"Парсер consultant.ru" namespace:"consultant" env-namespace:"CONSULTANT"`

		SuperJob struct {
			Timeout   time.Duration `` /* 165-byte string literal not displayed */
			UserAgent string        `` /* 141-byte string literal not displayed */
		} `group:"Парсер superjob.ru" namespace:"superjob" env-namespace:"SUPERJOB"`

		Override string `` /* 323-byte string literal not displayed */
	} `group:"Источник данных" namespace:"source" env-namespace:"SOURCE"`
}

func (*Server) Execute

func (s *Server) Execute(args []string) error

type Store

type Store interface {
	FindDay(y int, mon time.Month, d int) (*store.Day, bool)
	FindMonth(y int, mon time.Month) (store.Days, bool)
	FindYear(y int) (store.Months, bool)
	PutYear(y int, data store.Months) error
}

type Sync

type Sync struct {
	ServerUrl   string        `` /* 153-byte string literal not displayed */
	AdminPasswd string        `long:"passwd" short:"p" env:"WEB_ADMIN_PASSWD" value-name:"str" description:"Пароль пользователя admin."`
	Timeout     time.Duration `` /* 146-byte string literal not displayed */
	Years       []int         `` /* 228-byte string literal not displayed */
}

func (*Sync) Execute

func (s *Sync) Execute(args []string) error

Jump to

Keyboard shortcuts

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