config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyConfigPath = errors.New("empty configuration file path")

ErrEmptyConfigPath defines a sentinel error for an empty config path.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir    string   `toml:"data_dir"`
	ListenAddr string   `toml:"listen_addr"`
	Seeds      []string `toml:"seeds" validate:"required,min=1"`
	ReseedSize uint     `toml:"reseed_size"`
	IPStackKey string   `toml:"ipstack_key" validate:"required,min=1"`

	CrawlInterval   uint `toml:"crawl_interval"`
	RecheckInterval uint `toml:"recheck_interval"`
}

Config defines all necessary tmcrawl configuration parameters.

func ParseConfig

func ParseConfig(configPath string) (Config, error)

ParseConfig attempts to read and parse a tmcrawl config from the given file path. An error is returned if reading or parsing the config fails.

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the Config object is invalid.

Jump to

Keyboard shortcuts

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