config

package
v1.0.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LatestInstalledStrategy = "latest_installed"
	LatestAvailableStrategy = "latest_available"
	SpecifiedStrategy       = "specified"
	DefaultStrategy         = SpecifiedStrategy
)

Variables

View Source
var (
	DefaultConfig = &Config{
		Plugin:            Plugin{HTTP: &HTTP{}},
		Proxy:             EmptyProxy,
		Storage:           EmptyStorage,
		Registry:          EmptyRegistry,
		LegacyVersionFile: EmptyLegacyVersionFile,
		Cache:             EmptyCache,
		Gitignore:         EmptyGitignore,
	}
)
View Source
var (
	EmptyCache = &Cache{
		AvailableHookDuration: cache.Duration(12 * time.Hour),
	}
)
View Source
var EmptyGitignore = &Gitignore{
	Enable: true,
}
View Source
var EmptyLegacyVersionFile = &LegacyVersionFile{
	Enable:   true,
	Strategy: DefaultStrategy,
}
View Source
var (
	EmptyProxy = &Proxy{
		Url:    "",
		Enable: false,
	}
)
View Source
var EmptyRegistry = &Registry{
	Address: "",
}
View Source
var EmptyStorage = &Storage{
	SdkPath: "",
}

Functions

This section is empty.

Types

type Cache added in v0.5.0

type Cache struct {
	AvailableHookDuration cache.Duration `yaml:"availableHookDuration"` // Available hook result cache time
}

Cache is the cache configuration

type Config

type Config struct {
	Plugin            Plugin             `yaml:"plugin"`
	Proxy             *Proxy             `yaml:"proxy"`
	Storage           *Storage           `yaml:"storage"`
	Registry          *Registry          `yaml:"registry"`
	LegacyVersionFile *LegacyVersionFile `yaml:"legacyVersionFile"`
	Cache             *Cache             `yaml:"cache"`
	Gitignore         *Gitignore         `yaml:"gitignore"`
}

func LoadConfigWithFallback added in v1.0.0

func LoadConfigWithFallback(sharedPath, userPath string) (*Config, error)

LoadConfigWithFallback loads config from multiple paths with priority Priority: sharedPath (higher) > userPath (lower) If sharedPath doesn't exist or is empty, userConfig is used If both exist, they are merged with userConfig taking precedence for non-empty fields

func Merge added in v1.0.0

func Merge(sharedConfig, userConfig *Config) *Config

Merge merges two configs with userConfig taking precedence over sharedConfig Returns a new config where userConfig fields override sharedConfig fields If a field in userConfig is nil/empty, the sharedConfig value is used

func NewConfig

func NewConfig(path string) (*Config, error)

func NewConfigWithPath

func NewConfigWithPath(p string) (*Config, error)

func (*Config) SaveConfig added in v0.4.0

func (c *Config) SaveConfig(path string) error

type Gitignore added in v1.0.12

type Gitignore struct {
	Enable bool `yaml:"enable"`
}

Gitignore controls whether vfox automatically updates the project's .gitignore file when using a project-scoped version.

type HTTP added in v1.0.12

type HTTP struct {
	Timeout         time.Duration `yaml:"timeout"`
	DownloadTimeout time.Duration `yaml:"downloadTimeout"`
}

HTTP configures the Lua HTTP module. Zero inherits the shared setting, or uses the built-in default when no shared setting is provided.

func (*HTTP) Timeouts added in v1.0.12

func (h *HTTP) Timeouts() (request, download time.Duration)

Timeouts resolves defaults without changing the stored configuration, so omitted user fields can still inherit values from the shared configuration.

func (*HTTP) Validate added in v1.0.12

func (h *HTTP) Validate() error

type LegacyVersionFile added in v0.4.0

type LegacyVersionFile struct {
	Enable bool `yaml:"enable"`
	// Support three strategies:
	// 1. latest_installed: use the latest installed version
	// 2. latest_available: use the latest available version
	// 3. specified: use the specified version in the legacy file
	// default: specified
	Strategy string `yaml:"strategy"`
}

LegacyVersionFile represents whether to enable the ability to parse legacy version files,

type Plugin added in v1.0.12

type Plugin struct {
	HTTP *HTTP `yaml:"http"`
}

Plugin contains settings for Lua plugins.

type Proxy

type Proxy struct {
	Url    string `yaml:"url"`
	Enable bool   `yaml:"enable"`
}

type Registry added in v0.3.0

type Registry struct {
	Address string `yaml:"address"`
}

type Storage added in v0.2.3

type Storage struct {
	SdkPath string `yaml:"sdkPath"`
}

func (*Storage) Validate added in v0.2.3

func (s *Storage) Validate() error

Jump to

Keyboard shortcuts

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