config

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadProxies

func LoadProxies(filename string) []*url.URL

LoadProxies tries to load the list of proxies from the given file. If it fails, it returns an empty list.

Types

type Config

type Config struct {
	BotToken              string `yaml:"bot_token"`
	LangDirectory         string `yaml:"lang_path"`
	UpdateIntervalMinutes int    `yaml:"update_interval_minutes"`
	HTTPMaxTries          int    `yaml:"http_max_tries"`
	MaxPriceAgents        int64  `yaml:"max_price_agents"`
	Webhook               struct {
		Enabled     bool   `yaml:"enabled"`
		ListenIP    string `yaml:"listen_ip"`
		ListenPort  int    `yaml:"listen_port"`
		ListenPath  string `yaml:"listen_path"`
		URL         string `yaml:"url"`
		CertPath    string `yaml:"cert_path"`
		CertKeyPath string `yaml:"cert_key_path"`
	} `yaml:"webhook"`
	Proxy struct {
		Enabled       bool   `yaml:"enabled"`
		ProxyListPath string `yaml:"proxy_list_path"`
	} `yaml:"proxy"`
	LogDirectory string `yaml:"log_directory"`
	Prometheus   struct {
		Enabled    bool   `yaml:"enabled"`
		ExportIP   string `yaml:"export_ip"`
		ExportPort int    `yaml:"export_port"`
	} `yaml:"prometheus"`
}

func GetConfig added in v2.2.0

func GetConfig() (*Config, error)

GetConfig returns the config struct. If the config has not been initialized yet, an error is returned.

func ReadConfig

func ReadConfig(configFile string) (Config, error)

ReadConfig reads the config file and returns a filled Config struct.

Jump to

Keyboard shortcuts

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