Documentation
¶
Overview ¶
Package config holds CLI configuration.
Index ¶
Constants ¶
View Source
const ( // EnvarLogPath is the log file path. EnvarLogPath = "SQ_LOG_FILE" // EnvarLogLevel is the log level. It maps to a slog.Level. EnvarLogLevel = "SQ_LOG_LEVEL" // EnvarLogEnabled turns logging on or off. EnvarLogEnabled = "SQ_LOG" // EnvarConfigDir is the legacy envar for config location. // Instead use EnvarConfig. EnvarConfigDir = "SQ_CONFIGDIR" // EnvarConfig is the envar for config location. EnvarConfig = "SQ_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Version is the config version. This will allow sq to
// upgrade config files if needed. It must be a valid semver.
Version string `yaml:"config.version" json:"config_version"`
// Options contains default settings, such as output format.
Options options.Options `yaml:"options" json:"options"`
// Collection is the set of data sources.
Collection *source.Collection `yaml:"collection" json:"collection"`
// Ext holds sq config extensions, such as user driver config.
Ext Ext `yaml:"-" json:"-"`
}
Config holds application config/session data.
type DiscardStore ¶
type DiscardStore struct{}
DiscardStore implements Store but its Save method is no-op and Load always returns a new empty Config. Useful for testing.
type Ext ¶
type Ext struct {
UserDrivers []*userdriver.DriverDef `yaml:"user_drivers" json:"user_drivers"`
}
Ext holds additional config (extensions) loaded from other config files, e.g. ~/.config/sq/ext/*.sq.yml.
type Store ¶
type Store interface {
// Save writes config to the store.
Save(ctx context.Context, cfg *Config) error
// Load reads config from the store.
Load(ctx context.Context) (*Config, error)
// Location returns the location of the store, typically
// a file path.
Location() string
}
Store saves and loads config.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package yamlstore contains an implementation of config.Store that uses YAML files for persistence.
|
Package yamlstore contains an implementation of config.Store that uses YAML files for persistence. |
|
upgrades/v0.34.0
Package v0_34_0 upgrades YAML config to v0.34.0.
|
Package v0_34_0 upgrades YAML config to v0.34.0. |
Click to show internal directories.
Click to hide internal directories.