Documentation
¶
Overview ¶
Package config provides configuration structures and validation for the godyl application.
It defines the configuration structure, validation rules, and helper functions for working with application settings. The package handles various configuration options including update strategies, authentication tokens, and display preferences.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUsage = errors.New("usage error")
ErrUsage is returned when there is an error in the configuration.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Root level configuration, mapping configurations on the root `godyl` command
Root Root
// Tool level configuration, mapping configurations on the `install`, `download`,
// and (partially) the `update` commands
Tool Tool
// Dump level configuration, mapping configurations on the `dump` command
Dump Dump
}
type Dump ¶
type Dump struct {
// Format for outputting the configuration
Format string `validate:"oneof=json yaml"`
}
Dump holds the configuration for the `dump` command.
type Embedded ¶
type Embedded struct {
// Defaults to be set for each tool (not flags).
Defaults []byte
// Default list of tools that can be used to either view or dump out.
Tools []byte
// A template for the cleanup script.
Template []byte
}
Embedded holds the embedded files for the application.
type Root ¶
type Root struct {
// Show enables output display
Show bool
// Run without making any changes
Dry bool
// Log level (DEBUG, INFO, WARN, ERROR, SILENT)
Log string `validate:"oneof=DEBUG INFO WARN ERROR SILENT"`
// Path to .env file
DotEnv file.File `mapstructure:"env-file"`
// Path to defaults file
Defaults file.File
}
Root holds the root configuration options.
type Tokens ¶
type Tokens struct {
// GitHub token for authentication
GitHub string `mapstructure:"github-token" mask:"fixed"`
}
Tokens holds the configuration options for authentication tokens.
type Tool ¶
type Tool struct {
// Path to output the fetched tools to
Output string
// Tags to filter tools by
Tags []string
// Source from which to install the tools
Source sources.Type `validate:"oneof=github url go command"`
// Strategy to use for updating tools
Strategy tools.Strategy `validate:"oneof=none upgrade force"`
// Tokens for authentication
Tokens Tokens `mapstructure:",squash"`
// Operating system to install the tools for
OS string
// Architecture to install the tools for
Arch string
// Path to tools configuration file
Tools file.File // Positional argument
// Number of parallel downloads (>= 0)
Parallel int `validate:"gte=0"`
// Skip SSL verification
NoVerifySSL bool `mapstructure:"no-verify-ssl"`
// Additional hints to use for tool resolution
Hints []string
// Version of the tool to install
Version string
}
Tool holds the configuration options for fetching tools. These are used as flags, environment variables for the corresponding CLI commands, and used to set the tool configuration for each tool requested, unless explicitly set by the tool itself.