config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config provides a unified API for fetching asdf config. Either from the asdfrc file or environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Home                        string
	ConfigFile                  string
	DefaultToolVersionsFilename string
	DataDir                     string
	Settings                    Settings
	PluginIndexURL              string
}

Config is the primary value this package builds and returns

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig builds the Config struct from environment variables

func (*Config) AlwaysKeepDownload

func (c *Config) AlwaysKeepDownload() (bool, error)

AlwaysKeepDownload loads the asdfrc if it isn't already loaded and fetches the keep downloads boolean flag

func (*Config) Concurrency

func (c *Config) Concurrency() (string, error)

Concurrency returns concurrency setting from asdfrc file

func (*Config) DisablePluginShortNameRepository

func (c *Config) DisablePluginShortNameRepository() (bool, error)

DisablePluginShortNameRepository loads the asdfrc if it isn't already loaded and fetches the disable plugin short name repo flag

func (*Config) GetHook

func (c *Config) GetHook(hook string) (string, error)

GetHook returns a hook command from config if it is there

func (*Config) LegacyVersionFile

func (c *Config) LegacyVersionFile() (bool, error)

LegacyVersionFile loads the asdfrc if it isn't already loaded and fetches the legacy version file support flag

func (*Config) PluginRepositoryLastCheckDuration

func (c *Config) PluginRepositoryLastCheckDuration() (PluginRepoCheckDuration, error)

PluginRepositoryLastCheckDuration loads the asdfrc if it isn't already loaded and fetches the keep boolean flag

type PluginRepoCheckDuration

type PluginRepoCheckDuration struct {
	Never bool
	Every int
}
PluginRepoCheckDuration represents the remote plugin repo check duration

* (never or every N seconds). It's not clear to me how this should be * represented in Golang so using a struct for maximum flexibility.

type Settings

type Settings struct {
	Loaded            bool
	Raw               *ini.Section
	LegacyVersionFile bool
	// I don't think this setting should be supported in the Golang implementation
	// UseReleaseCandidates bool
	AlwaysKeepDownload                bool
	PluginRepositoryLastCheckDuration PluginRepoCheckDuration
	DisablePluginShortNameRepository  bool
	Concurrency                       string
}

Settings is a struct that stores config values from the asdfrc file

Jump to

Keyboard shortcuts

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