config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigEmpty        = fmt.Errorf("config is empty")
	ErrDirectoryEmpty     = fmt.Errorf("direcotory cannot be empty")
	ErrPathNotUnderOutDir = func(idx int, p string, outDir string) error {
		return fmt.Errorf(dependencyInvalid(idx).Error()+"Path (%s) is not under output directory: (%s). DON'T use \"..\" in path variable.", p, outDir)
	}

	// Source errors
	ErrSourceInvalid = func(idx int, source string, err error) error {
		return fmt.Errorf(dependencyInvalid(idx).Error()+"source: %s is invalid => %v", source, err)
	}
	ErrSourceAndSourcesSet = func(idx int) error {
		return fmt.Errorf(dependencyInvalid(idx).Error() + "source and sources cannot be set at the same time in dependency")
	}
	ErrSourceUnregisteredDomain = func(source string, domain string) error {
		return fmt.Errorf("unregistered domain: %s for source: %s", domain, source)
	}

	ErrDomainEmpty         = fmt.Errorf("domain cannot be empty")
	ErrDomainAlreadyExists = func(domain string) error {
		return fmt.Errorf("domain: %s already has been added", domain)
	}
	ErrInvalidDomainAPI = func(d string) error {
		return fmt.Errorf("invalid api for domain: %s. allowed API domains are: %+v", d, domain.AllowedDomainsAPI)
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Directory    string        `yaml:"directory" json:"directory"`
	Dependencies []*Dependency `yaml:"dependencies" json:"dependencies"`
	Domains      []*Domain     `yaml:"domains" json:"domains"`
	// contains filtered or unexported fields
}

func Load

func Load(configPath string, outputDir string) (_ *Config, err error)

type Dependency

type Dependency struct {
	Path string `yaml:"path" json:"path"`

	Source  string   `yaml:"source" json:"source"`
	Sources []string `yaml:"sources" json:"sources"`
}

type Domain

type Domain struct {
	Host string `yaml:"host" json:"host"`
	API  string `yaml:"api" json:"api"`
}

Jump to

Keyboard shortcuts

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