config

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadYaml

func ReadYaml[T any](fileName string) (T, error)

Types

type Artifactory

type Artifactory struct {
	User        string `json:"user"`
	AccessToken string `json:"token"`
	BaseURL     URL    `json:"url"`
	Timeout     int    `json:"timeout"`
	BodyLimit   int64  `json:"bodyLimit"`
}

type BitBucketRepo

type BitBucketRepo struct {
	Repo        Repo   `json:"repo"`
	User        string `json:"user"`
	AccessToken string `json:"token"`
	BaseURL     URL    `json:"url"`
	Timeout     int    `json:"timeout"`
	BodyLimit   int64  `json:"bodyLimit"`
}

type Cache

type Cache struct {
	Type        cachetype.Type `json:"type"`
	Local       CacheLocal     `json:"local"`
	Artifactory Artifactory    `json:"artifactory"`
}

type CacheLocal

type CacheLocal struct {
	Dir string `json:"directory"`
}

type Config

type Config struct {
	Listen  netip.AddrPort `json:"listen"`
	Domain  string         `json:"domain"`
	TLS     TLSConfig      `json:"tls"`
	Cache   Cache          `json:"cache"`
	Proxy   Proxy          `json:"proxy"`
	Local   LocalGit       `json:"local"`
	Log     LogConfig      `json:"log"`
	Connect Connect        `json:"connect"`
}

type Connect added in v0.3.6

type Connect struct {
	Probe ProbeConfig `json:"probe"`
}

Connect configures the buf v1 registry commit-id resolution behavior in internal/connect. All fields default sensibly (WithDefaults) so the proxy behaves as intended with no connect: block in the config file.

func (Connect) WithDefaults added in v0.3.6

func (c Connect) WithDefaults() Connect

WithDefaults returns a copy of the Connect config with zero-value fields replaced by the documented defaults. Called once at startup after the config is loaded.

type GithubRepo

type GithubRepo struct {
	Repo        Repo   `json:"repo"`
	AccessToken string `json:"token"`
	Timeout     int    `json:"timeout"`
	BodyLimit   int64  `json:"bodyLimit"`
}

type LocalGit

type LocalGit struct {
	Storage string `json:"storage"`
	Repos   []Repo `json:"repo"`
}

type LogConfig

type LogConfig struct {
	Level     string `json:"level"`
	Format    string `json:"format,omitempty"`
	AddSource bool   `json:"add_source,omitempty"`
}

type ProbeConfig added in v0.3.6

type ProbeConfig struct {
	// Enabled is a pointer so we can distinguish "unset" (default true) from
	// an explicit false. Set enabled: false to disable.
	Enabled        *bool         `json:"enabled"`
	NegativeTTL    time.Duration `json:"negative_ttl"`
	PerCallTimeout time.Duration `json:"per_call_timeout"`
}

ProbeConfig controls the upstream sha probe used on a Download cache miss: the proxy asks each configured source whether it owns the requested sha and, on a hit, resolves the module. Bogus shas are negative-cached for NegativeTTL to bound repeat cost.

type Proxy

type Proxy struct {
	Github    []GithubRepo    `json:"github"`
	BitBucket []BitBucketRepo `json:"bitbucket"`
}

type Repo

type Repo struct {
	Owner    string   `json:"owner"`
	Name     string   `json:"name"`
	Prefixes []string `json:"prefix"`
	Paths    []string `json:"path"`
}

type TLSConfig

type TLSConfig struct {
	CertFile   string `json:"cert"`
	KeyFile    string `json:"key"`
	CACertFile string `json:"ca"`
}

type URL

type URL struct {
	url.URL
}

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(text []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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