config

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBlocklistsProvided = errors.New("no blocklists provided")

Functions

func Edit

func Edit() error

Edit opens config in text editor.

func Init

func Init() error

Init saves default configuration file locally in case if it doesn't exist yet.

func Validate

func Validate(config *Config) error

Types

type Config

type Config struct {
	// Blocklist is a structure that represents where all these domains that needs
	// to be blocked are located.
	Blocklists []Domainlist `yaml:"blocklists"`

	// Whitelists contains domains that must not be blocked.
	// Adding some domains to whitelist may fix many problems like YouTube
	// watch history, videos on news sites and so on.
	Whitelists []Domainlist `yaml:"whitelists"`
}

Config represents the entire configuration structure.

func Load

func Load() (*Config, error)

Load loads config file. If config file is located at filesystem, it merges its options with default one and returns the result. If config file simply doesn't present at filesystem, it returns default one.

func LoadByUser

func LoadByUser(location string) (*Config, error)

LoadByUser loads config file at the location that was provided by the user via config-file CLI flag.

func (*Config) Print

func (c *Config) Print()

Print prints config to stdout.

type Domainlist added in v1.0.4

type Domainlist struct {
	Target string `yaml:"target"`
}

Jump to

Keyboard shortcuts

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