config

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationName = "glaball"
)
View Source
const (
	DefaultCacheSize = "100MB"
)

Variables

This section is empty.

Functions

func DefaultCacheDir

func DefaultCacheDir() (string, error)

func DefaultConfigDir

func DefaultConfigDir() (string, error)

Types

type CacheOptions

type CacheOptions struct {
	Enabled      bool           `yaml:"enabled" mapstructure:"enabled"`
	BasePath     string         `yaml:"path" mapstructure:"path"`
	CacheSizeMax string         `yaml:"size" mapstructure:"size"`
	Compression  bool           `yaml:"compression" mapstructure:"compression"`
	TTL          *time.Duration `yaml:"ttl" mapstructure:"ttl"`
}

func (*CacheOptions) DiskCache

func (c *CacheOptions) DiskCache() (*diskcache.Cache, error)

func (*CacheOptions) Diskv

func (c *CacheOptions) Diskv() (*diskv.Diskv, error)

func (*CacheOptions) DiskvOptions

func (c *CacheOptions) DiskvOptions() (diskv.Options, error)

type Config

type Config struct {
	Hosts   Hosts        `yaml:"hosts" mapstructure:"hosts"`
	Cache   CacheOptions `yaml:"cache" mapstructure:"cache"`
	Filter  string       `yaml:"filter" mapstructure:"filter"`
	Threads int          `yaml:"threads" mapstructure:"threads"`
	ShowAll bool         `yaml:"all" mapstructure:"all"`
}

func FromFile

func FromFile(path string) (*Config, error)

type Host

type Host struct {
	URL         string             `yaml:"url" mapstructure:"url"`
	IP          string             `yaml:"ip" mapstructure:"ip"`
	Token       string             `yaml:"token" mapstructure:"token"`
	RateLimiter RateLimiterOptions `yaml:"rate_limiter" mapstructure:"rate_limiter"`
}

type Hosts

type Hosts map[string]map[string]map[string]Host

type RateLimiterOptions

type RateLimiterOptions struct {
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}

Jump to

Keyboard shortcuts

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