config

package
v1.6.0-next.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAliases = Aliases{
	"dist": {
		Name:    "github/ekristen/distillery",
		Version: "latest",
	},
}

DefaultAliases - default aliases for distillery, this will only ever be `dist`, I have no plans on maintain aliases for other projects, that is what the configuration is for and is part of the design of this tool, no central repository.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Name    string          `yaml:"name" toml:"name"`
	Version string          `yaml:"version" toml:"version"`
	Flags   map[string]bool `yaml:"flags" toml:"flags"`
}

func (*Alias) UnmarshalText

func (a *Alias) UnmarshalText(b []byte) error

func (*Alias) UnmarshalYAML

func (a *Alias) UnmarshalYAML(unmarshal func(interface{}) error) error

type Aliases

type Aliases map[string]*Alias

type Config

type Config struct {
	// Path - path to store the configuration files, this path is set by default based on the operating system type
	// and your user's home directory. Typically, this is set to $HOME/.distillery
	Path string `yaml:"path" toml:"path"`

	// BinPath - path to create symlinks for your binaries, this path is set by default based on the operating system type
	// This is the path that is added to your PATH environment variable. Typically, this is set to $HOME/.distillery/bin
	// This allows you to override the location for symlinks. For example, you can instead put them all in /usr/local/bin
	BinPath string `yaml:"bin_path" toml:"bin_path"`

	// CachePath - path to store cache files, this path is set by default based on the operating system type
	CachePath string `yaml:"cache_path" toml:"cache_path"`

	// DefaultSource - the default source to use when installing binaries, this defaults to GitHub
	DefaultSource string `yaml:"default_source" toml:"default_source"`

	// Aliases - Allow for creating shorthand aliases for source locations that you use frequently. A good example
	// of this is `distillery` -> `ekristen/distillery`
	Aliases *Aliases `yaml:"aliases" toml:"aliases"`

	// Language - the language to use for the output of the application
	Language string `yaml:"language" toml:"language"`

	// Providers - allow for custom providers that uses one of the build in providers as a base. A good example of this
	// is gitlab.alpinelinux.org, since gitlab is open source, you can use the gitlab provider as a base
	Providers map[string]*Provider `yaml:"providers" toml:"providers"`

	// Settings - settings to control the behavior of distillery
	Settings *Settings `yaml:"settings" toml:"settings"`
}

Config - the configuration for distillery

func New

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

New - create a new configuration object

func (*Config) GetAlias

func (c *Config) GetAlias(name string) *Alias

GetAlias - get an alias by name

func (*Config) GetAliases added in v1.6.0

func (c *Config) GetAliases() *Aliases

GetAliases - get all defined aliases, add the default alias if it doesn't exist

func (*Config) GetCachePath

func (c *Config) GetCachePath() string

GetCachePath - get the cache path

func (*Config) GetDownloadsPath

func (c *Config) GetDownloadsPath() string

GetDownloadsPath - get the downloads path

func (*Config) GetMetadataPath

func (c *Config) GetMetadataPath() string

GetMetadataPath - get the metadata path

func (*Config) GetOptPath

func (c *Config) GetOptPath() string

GetOptPath - get the opt path

func (*Config) GetPath

func (c *Config) GetPath() string

func (*Config) Load

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

Load - load the configuration file

func (*Config) MkdirAll

func (c *Config) MkdirAll() error

MkdirAll - create all the directories

type Provider

type Provider struct {
	Provider string `yaml:"provider" toml:"provider"`
	BaseURL  string `yaml:"base_url" toml:"base_url"`
}

type Settings added in v1.1.0

type Settings struct {
	// ChecksumMissing - behavior when a checksum file is missing, this defaults to "warn", other options are "error" and "ignore"
	ChecksumMissing string `yaml:"checksum-missing" toml:"checksum-missing"`

	// ChecksumMismatch - behavior when a checksum file is missing, this defaults to "warn", other options are "error" and "ignore"
	SignatureMissing string `yaml:"signature-missing" toml:"signature-missing"`

	// ChecksumUnknown - behavior when a checksum method cannot be determined, this defaults to "warn", other options are "error" and "ignore"
	ChecksumUnknown string `yaml:"checksum-unknown" toml:"checksum-unknown"`
}

Settings - settings to control the behavior of distillery

func (*Settings) Defaults added in v1.1.0

func (s *Settings) Defaults()

Defaults - set the default values for the settings

Jump to

Keyboard shortcuts

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