config

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config contains application configuration struct with the most useful functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Sources []source `yaml:"sources"`

	RouterScript struct {
		Redirect struct {
			Address string `yaml:"address"`
		} `yaml:"redirect"`
		Exclude struct {
			Hosts []string `yaml:"hosts"`
		} `yaml:"exclude"`
		Comment            string `yaml:"comment"`
		MaxSourcesCount    uint16 `yaml:"max_sources"`
		MaxSourceSizeBytes uint32 `yaml:"max_source_size"`
	} `yaml:"router_script"`
}

Config is main application configuration.

func FromYaml

func FromYaml(in []byte, expandEnv bool) (*Config, error)

FromYaml creates new config instance using YAML-structured content.

func FromYamlFile

func FromYamlFile(filename string, expandEnv bool) (*Config, error)

FromYamlFile creates new config instance using YAML file.

func (*Config) AddSource

func (cfg *Config) AddSource(uri, name, description string, enabledByDefault bool, recordsCount uint)

AddSource into sources list.

func (*Config) FromYaml

func (cfg *Config) FromYaml(in []byte, expandEnv bool) error

FromYaml configures itself using YAML content.

Jump to

Keyboard shortcuts

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