config

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLocale string = "en-US"

Variables

View Source
var EnabledEngines []engines.Name = make([]engines.Name, 0)
View Source
var LogDumpLocation string = "dump/"

Functions

func NewAllEnabled

func NewAllEnabled() []engines.Name

func NewInfo

func NewInfo() []engines.Name

func NewSettings

func NewSettings() map[engines.Name]Settings

Types

type Cache

type Cache struct {
	Type  string `koanf:"type"`
	Redis Redis  `koanf:"redis"`
}

type Category

type Category struct {
	Engines []engines.Name
	Ranking Ranking
	Timings Timings
}

type Config

type Config struct {
	Server     Server
	Categories map[category.Name]Category
	Settings   map[engines.Name]Settings
}

func New

func New() *Config

func (*Config) Load

func (c *Config) Load(dataDirPath string, logDirPath string)

type EngineRanking

type EngineRanking struct {
	Mul   float64 `koanf:"mul"`
	Const float64 `koanf:"const"`
}

type Ranking

type Ranking struct {
	REXP    float64                  `koanf:"rexp"`
	A       float64                  `koanf:"a"`
	B       float64                  `koanf:"b"`
	C       float64                  `koanf:"c"`
	D       float64                  `koanf:"d"`
	TRA     float64                  `koanf:"tra"`
	TRB     float64                  `koanf:"trb"`
	TRC     float64                  `koanf:"trc"`
	TRD     float64                  `koanf:"trd"`
	Engines map[string]EngineRanking `koanf:"engines"`
}

func NewRanking

func NewRanking() Ranking

type ReaderCategory

type ReaderCategory struct {
	REngines map[string]ReaderEngine `koanf:"engines"`
	Ranking  Ranking                 `koanf:"ranking"`
	RTimings ReaderTimings           `koanf:"timings"`
}

type ReaderConfig

type ReaderConfig struct {
	Server      Server                           `koanf:"server"`
	RCategories map[category.Name]ReaderCategory `koanf:"categories"`
	Settings    map[string]Settings              `koanf:"settings"`
}

type ReaderEngine

type ReaderEngine struct {
	Enabled bool `koanf:"enabled"`
}

type ReaderTimings

type ReaderTimings struct {
	// HardTimeout uint `koanf:"hardTimeout"`
	Timeout     uint `koanf:"timeout"`
	PageTimeout uint `koanf:"pagetimeout"`
	Delay       uint `koanf:"delay"`
	RandomDelay uint `koanf:"randomdelay"`
	Parallelism int  `koanf:"parallelism"`
}

in miliseconds

type Redis

type Redis struct {
	Host     string `koanf:"host"`
	Port     uint16 `koanf:"port"`
	Password string `koanf:"password"`
	Database uint8  `koanf:"database"`
}

type Server

type Server struct {
	Port        int    `koanf:"port"`
	FrontendUrl string `koanf:"frontendurl"`
	Cache       Cache  `koanf:"cache"`
}

type Settings

type Settings struct {
	RequestedResultsPerPage int    `koanf:"requestedresults"`
	Shortcut                string `koanf:"shortcut"`
}

type Timings

type Timings struct {
	// HardTimeout time.Duration
	Timeout     time.Duration
	PageTimeout time.Duration
	Delay       time.Duration
	RandomDelay time.Duration
	Parallelism int
}

Delegates Timeout, PageTimeout to colly.Collector.SetRequestTimeout(); Note: See https://github.com/gocolly/colly/issues/644 Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit()

Jump to

Keyboard shortcuts

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