Documentation
¶
Overview ¶
Package config provides configuration management for the kat application.
It wraps other package configuration to provide a single API for loading, validating, and writing configuration files in YAML format.
Additionally, it implements JSON schema generation and validation for the configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ValidAPIVersions = []string{ "kat.jacobcolvin.com/v1beta1", } ValidKinds = []string{ "Configuration", } DefaultValidator = yaml.MustNewValidator("/config.v1beta1.json", schemaJSON) )
Functions ¶
func WriteDefaultConfig ¶
WriteDefaultConfig writes the embedded default config.yaml and jsonschema to the specified path.
Types ¶
type Config ¶
type Config struct {
Command *command.Config `json:",inline"`
UI *ui.Config `json:",inline"`
// APIVersion specifies the API version for this configuration.
APIVersion string `json:"apiVersion" jsonschema:"title=API Version"`
// Kind defines the type of configuration.
Kind string `json:"kind" jsonschema:"title=Kind"`
}
func (*Config) EnsureDefaults ¶
func (c *Config) EnsureDefaults()
func (Config) JSONSchemaExtend ¶ added in v0.15.0
func (c Config) JSONSchemaExtend(jss *jsonschema.Schema)
func (Config) MarshalYAML ¶
type ConfigLoader ¶ added in v0.22.0
type ConfigLoader struct {
// contains filtered or unexported fields
}
func NewConfigLoaderFromBytes ¶ added in v0.22.0
func NewConfigLoaderFromBytes(data []byte, opts ...ConfigLoaderOpt) *ConfigLoader
func NewConfigLoaderFromFile ¶ added in v0.22.0
func NewConfigLoaderFromFile(path string, opts ...ConfigLoaderOpt) (*ConfigLoader, error)
func (*ConfigLoader) GetTheme ¶ added in v0.22.0
func (cl *ConfigLoader) GetTheme() *theme.Theme
func (*ConfigLoader) Load ¶ added in v0.22.0
func (cl *ConfigLoader) Load() (*Config, error)
func (*ConfigLoader) Validate ¶ added in v0.22.0
func (cl *ConfigLoader) Validate() error
Validate validates configuration data with ConfigValidator without loading it into a Config struct.
type ConfigLoaderOpt ¶ added in v0.22.0
type ConfigLoaderOpt func(*ConfigLoader)
func WithConfigValidator ¶ added in v0.22.0
func WithConfigValidator(cv ConfigValidator) ConfigLoaderOpt
func WithThemeFromData ¶ added in v0.22.0
func WithThemeFromData() ConfigLoaderOpt
type ConfigValidator ¶ added in v0.22.0
Click to show internal directories.
Click to hide internal directories.