Documentation
¶
Overview ¶
Package config resolves aptbase settings from layered sources.
Resolution order, where a later layer overrides an earlier one (last wins):
built-in defaults → /etc/aptbase/config.ini → ~/.config/aptbase/config.ini → APTBASE_* environment variables → command-line flags (only when explicitly set)
When --config (or APTBASE_CONFIG) names an explicit file, only that file is read instead of the two well-known locations.
Index ¶
Constants ¶
const ( KeyAPI = "api" KeyServer = "server" KeyUser = "user" KeyPassword = "password" KeyDistributions = "distributions" KeyRepos = "repos" KeyPrefix = "prefix" KeyInsecure = "insecure" KeyTimeout = "timeout" KeyJSON = "json" KeyNoColor = "no-color" KeyYes = "yes" )
Setting keys. These double as INI keys and CLI flag names.
const DefaultTemplate = `` /* 1346-byte string literal not displayed */
DefaultTemplate is the annotated config.ini written by `aptbase config new`.
const SystemConfigPath = "/etc/aptbase/config.ini"
SystemConfigPath is the default system-wide config location.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render produces a config.ini reflecting the resolved settings (config file + env + flags combined). It is written by `aptbase config print` so the current effective configuration can be captured and piped to a file. The output is plain text with no color, suitable for redirection.
func WriteDefault ¶
WriteDefault writes the annotated default template to path. It refuses to overwrite an existing file unless force is true, creating parent directories as needed.
Types ¶
type Settings ¶
type Settings struct {
APIs []string
Server string
User string
Password string
HasPassword bool // whether a password was supplied (vs. prompt-on-401)
Distributions []string
Repos []string
Prefix string
Insecure bool
Timeout time.Duration
JSON bool
NoColor bool
Yes bool
// contains filtered or unexported fields
}
Settings holds the fully resolved configuration for a single invocation.
func Defaults ¶
func Defaults() *Settings
Defaults returns the built-in default settings (the base layer before any config file, environment, or flag is applied).