config

package
v0.0.0-...-757a075 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBaseURL = errors.New("invalid base url - must start with http:// or https://")
	ErrInvalidCreds   = errors.New("invalid creds - must be in format \"apiKey:apiSecret\"")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Opnsense `yaml:"opnsense"`
	Listen   `yaml:"listen"`
	// Filter is the domains to match for this provider
	DomainFilter `yaml:"filter"`
	LogLevel     slog.Level `yaml:"loglevel" env:"LOG_LEVEL"`
}

func Load

func Load(path string) (Config, error)

func (*Config) Validate

func (cfg *Config) Validate() error

type DomainFilter

type DomainFilter struct {
	// Filter is the domains we want to match and work with
	Filter []string `yaml:"filter" env:"DOMAIN_FILTER"`
	// Exclude is the domains we want to exclude and not touch
	Exclude []string `yaml:"exclude" env:"DOMAIN_EXCLUDE"`
}

type Listen

type Listen struct {
	// Addr is the address + port we listen on
	Addr string `yaml:"addr" env:"LISTEN_ADDR" env-default:":8080"`
}

type Opnsense

type Opnsense struct {
	// BaseURL of OPNSense instance. Must include the protocol
	// eg: https://router.yourdomain.fqdn or http://10.0.0.1
	BaseURL string `yaml:"baseurl" env:"OPNSENSE_BASEURL"`
	// Creds in the form of APIKey:Secret
	// obtained from OPNSense
	Creds string `yaml:"creds" env:"OPNSENSE_CREDS"`
}

Jump to

Keyboard shortcuts

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