config

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMustBeScalar = errors.New("URL must be a scalar")

Functions

This section is empty.

Types

type AnsibleGalaxy added in v0.0.17

type AnsibleGalaxy struct {
	Upstream       string
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type Cache

type Cache struct {
	Path      string
	Private   bool
	QuotaLow  units.DiskQuota `yaml:"quota_low"`
	QuotaHigh units.DiskQuota `yaml:"quota_high"`
}

func (Cache) GetQuotaHigh

func (c Cache) GetQuotaHigh() (units.Bytes, error)

func (Cache) GetQuotaLow

func (c Cache) GetQuotaLow() (units.Bytes, error)

type Config

type Config struct {
	Host              string
	Cache             Cache
	HTTPClient        HTTPClient `yaml:"http"`
	AdminInterface    string     `yaml:"admin_interface"`
	EnableMetrics     bool       `yaml:"metrics"`
	EnableProfiling   bool       `yaml:"profiling"`
	Log               Log
	AnsibleGalaxies   []AnsibleGalaxy `yaml:"ansible_galaxies"`
	GoProxies         []GoProxy       `yaml:"go_proxies"`
	NpmRegistries     []NpmRegistry   `yaml:"npm_registries"`
	OciRegistries     []OciRegistry   `yaml:"oci_registries"`
	PyPIRegistries    []PyPIRegistry  `yaml:"pypi_registries"`
	Proxies           []Proxy
	RubyGemRegistries []RubyGemRegistry `yaml:"rubygem_registries"`
}

func Default

func Default(envLookup func(string) (string, bool)) (*Config, error)

func Parse

func Parse(configPath string, envLookup func(string) (string, bool)) (*Config, error)

type GoProxy

type GoProxy struct {
	Upstream       string
	SumDBURL       string `yaml:"sumdb_url"`
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type HTTPClient added in v0.0.18

type HTTPClient struct {
	Timeout time.Duration
}

type Log

type Log struct {
	Level  zerolog.Level
	Format string
}

type NpmRegistry

type NpmRegistry struct {
	Upstream       string
	Scheme         string
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type OciRegistry

type OciRegistry struct {
	Upstream       string
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type Proxy

type Proxy struct {
	AllowedUpstreams []string `yaml:"allowed_upstreams"`
	Port             uint16
	UpstreamCaches   []SerializableURL `yaml:"upstream_caches"`
}

type PyPIRegistry

type PyPIRegistry struct {
	Upstream       string
	CDN            string
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type RubyGemRegistry added in v0.0.8

type RubyGemRegistry struct {
	Upstream       string
	Port           uint16
	UpstreamCaches []SerializableURL `yaml:"upstream_caches"`
}

type SerializableURL added in v0.0.5

type SerializableURL struct {
	URL *url.URL
}

func (SerializableURL) MarshalYAML added in v0.0.8

func (s SerializableURL) MarshalYAML() (any, error)

func (*SerializableURL) UnmarshalYAML added in v0.0.5

func (s *SerializableURL) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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