Documentation
¶
Index ¶
- Variables
- type AWSConfig
- type BaseConfigHandler
- type ClusterConfig
- type Config
- type ConfigHandler
- type Context
- type DNSConfig
- type DockerConfig
- type GitConfig
- type GitLivereloadConfig
- type LocalstackConfig
- type MockConfigHandler
- func (m *MockConfigHandler) Get(key string) interface{}
- func (m *MockConfigHandler) GetBool(key string, defaultValue ...bool) bool
- func (m *MockConfigHandler) GetConfig() *Context
- func (m *MockConfigHandler) GetInt(key string, defaultValue ...int) int
- func (m *MockConfigHandler) GetString(key string, defaultValue ...string) string
- func (m *MockConfigHandler) LoadConfig(path string) error
- func (m *MockConfigHandler) SaveConfig(path string) error
- func (m *MockConfigHandler) Set(key string, value interface{}) error
- func (m *MockConfigHandler) SetContextValue(key string, value interface{}) error
- func (m *MockConfigHandler) SetDefault(context Context) error
- type NodeConfig
- type Registry
- type TerraformConfig
- type VMConfig
- type YamlConfigHandler
- func (y *YamlConfigHandler) Get(path string) interface{}
- func (y *YamlConfigHandler) GetBool(key string, defaultValue ...bool) bool
- func (y *YamlConfigHandler) GetConfig() *Context
- func (y *YamlConfigHandler) GetInt(key string, defaultValue ...int) int
- func (y *YamlConfigHandler) GetString(key string, defaultValue ...string) string
- func (y *YamlConfigHandler) LoadConfig(path string) error
- func (y *YamlConfigHandler) SaveConfig(path string) error
- func (y *YamlConfigHandler) Set(path string, value interface{}) error
- func (y *YamlConfigHandler) SetContextValue(path string, value interface{}) error
- func (y *YamlConfigHandler) SetDefault(context Context) error
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Context{ Environment: map[string]string{}, AWS: &AWSConfig{ Enabled: nil, AWSEndpointURL: nil, AWSProfile: nil, S3Hostname: nil, MWAAEndpoint: nil, Localstack: &LocalstackConfig{ Enabled: nil, Services: nil, }, }, Docker: &DockerConfig{ Enabled: nil, Registries: []Registry{}, NetworkCIDR: nil, }, Terraform: &TerraformConfig{ Backend: nil, }, Cluster: nil, DNS: &DNSConfig{ Enabled: nil, Name: nil, Address: nil, }, }
DefaultConfig returns the default configuration
var DefaultLocalConfig = Context{ Environment: map[string]string{}, Docker: &DockerConfig{ Enabled: ptrBool(true), Registries: []Registry{ { Name: "registry", }, { Name: "registry-1.docker", Remote: "https://registry-1.docker.io", Local: "https://docker.io", }, { Name: "registry.k8s", Remote: "https://registry.k8s.io", }, { Name: "gcr", Remote: "https://gcr.io", }, { Name: "ghcr", Remote: "https://ghcr.io", }, { Name: "quay", Remote: "https://quay.io", }, }, NetworkCIDR: ptrString("10.5.0.0/16"), }, Git: &GitConfig{ Livereload: &GitLivereloadConfig{ Enabled: ptrBool(true), RsyncExclude: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_RSYNC_EXCLUDE), RsyncProtect: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_RSYNC_PROTECT), Username: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_USERNAME), Password: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_PASSWORD), WebhookUrl: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_WEBHOOK_URL), Image: ptrString(constants.DEFAULT_GIT_LIVE_RELOAD_IMAGE), VerifySsl: ptrBool(false), }, }, Terraform: &TerraformConfig{ Backend: ptrString("local"), }, Cluster: &ClusterConfig{ Enabled: ptrBool(true), Driver: ptrString("talos"), ControlPlanes: struct { Count *int `yaml:"count"` CPU *int `yaml:"cpu"` Memory *int `yaml:"memory"` Nodes map[string]NodeConfig `yaml:"nodes"` }{ Count: ptrInt(1), CPU: ptrInt(2), Memory: ptrInt(2), Nodes: make(map[string]NodeConfig), }, Workers: struct { Count *int `yaml:"count"` CPU *int `yaml:"cpu"` Memory *int `yaml:"memory"` Nodes map[string]NodeConfig `yaml:"nodes"` }{ Count: ptrInt(1), CPU: ptrInt(4), Memory: ptrInt(4), Nodes: make(map[string]NodeConfig), }, }, DNS: &DNSConfig{ Enabled: ptrBool(true), Name: ptrString("test"), Address: nil, }, }
DefaultLocalConfig returns the default configuration for the "local" context
Functions ¶
This section is empty.
Types ¶
type AWSConfig ¶
type AWSConfig struct {
Enabled *bool `yaml:"enabled"`
AWSEndpointURL *string `yaml:"aws_endpoint_url"`
AWSProfile *string `yaml:"aws_profile"`
S3Hostname *string `yaml:"s3_hostname"`
MWAAEndpoint *string `yaml:"mwaa_endpoint"`
Localstack *LocalstackConfig `yaml:"localstack"`
}
AWSConfig represents the AWS configuration
type BaseConfigHandler ¶
type BaseConfigHandler struct {
ConfigHandler
}
BaseConfigHandler is a base implementation of the ConfigHandler interface
type ClusterConfig ¶
type ClusterConfig struct {
Enabled *bool `yaml:"enabled"`
Driver *string `yaml:"driver"`
ControlPlanes struct {
Count *int `yaml:"count"`
CPU *int `yaml:"cpu"`
Memory *int `yaml:"memory"`
Nodes map[string]NodeConfig `yaml:"nodes"`
} `yaml:"controlplanes"`
Workers struct {
Count *int `yaml:"count"`
CPU *int `yaml:"cpu"`
Memory *int `yaml:"memory"`
Nodes map[string]NodeConfig `yaml:"nodes"`
} `yaml:"workers"`
}
ClusterConfig represents the cluster configuration
type Config ¶
type Config struct {
Context *string `yaml:"context"`
Contexts map[string]*Context `yaml:"contexts"`
}
Config represents the entire configuration
type ConfigHandler ¶
type ConfigHandler interface {
// LoadConfig loads the configuration from the specified path
LoadConfig(path string) error
// GetString retrieves a string value for the specified key from the configuration
GetString(key string, defaultValue ...string) string
// GetInt retrieves an integer value for the specified key from the configuration
GetInt(key string, defaultValue ...int) int
// GetBool retrieves a boolean value for the specified key from the configuration
GetBool(key string, defaultValue ...bool) bool
// Set sets the value for the specified key in the configuration
Set(key string, value interface{}) error
// SetContextValue sets the value for the specified key in the configuration
SetContextValue(key string, value interface{}) error
// Get retrieves a value for the specified key from the configuration
Get(key string) interface{}
// SaveConfig saves the current configuration to the specified path
SaveConfig(path string) error
// SetDefault sets the default context configuration
SetDefault(context Context) error
// GetConfig returns the context config object
GetConfig() *Context
}
ConfigHandler defines the interface for handling configuration operations
type Context ¶
type Context struct {
Environment map[string]string `yaml:"environment"`
AWS *AWSConfig `yaml:"aws"`
Docker *DockerConfig `yaml:"docker"`
Git *GitConfig `yaml:"git"`
Terraform *TerraformConfig `yaml:"terraform"`
VM *VMConfig `yaml:"vm"`
Cluster *ClusterConfig `yaml:"cluster"`
DNS *DNSConfig `yaml:"dns"`
}
Context represents the context configuration
type DNSConfig ¶
type DNSConfig struct {
Enabled *bool `yaml:"enabled"`
Name *string `yaml:"name"`
Address *string `yaml:"address"`
}
DNSConfig represents the DNS configuration
type DockerConfig ¶
type DockerConfig struct {
Enabled *bool `yaml:"enabled"`
Registries []Registry `yaml:"registries"`
NetworkCIDR *string `yaml:"network_cidr"`
}
DockerConfig represents the Docker configuration
type GitConfig ¶
type GitConfig struct {
Livereload *GitLivereloadConfig `yaml:"livereload"`
}
GitConfig represents the Git configuration
type GitLivereloadConfig ¶
type GitLivereloadConfig struct {
Enabled *bool `yaml:"enabled"`
RsyncExclude *string `yaml:"rsync_exclude"`
RsyncProtect *string `yaml:"rsync_protect"`
Username *string `yaml:"username"`
Password *string `yaml:"password"`
WebhookUrl *string `yaml:"webhook_url"`
VerifySsl *bool `yaml:"verify_ssl"`
Image *string `yaml:"image"`
}
GitLivereloadConfig represents the Git livereload configuration
type LocalstackConfig ¶
LocalstackConfig represents the Localstack configuration
type MockConfigHandler ¶
type MockConfigHandler struct {
LoadConfigFunc func(path string) error
GetStringFunc func(key string, defaultValue ...string) string
GetIntFunc func(key string, defaultValue ...int) int
GetBoolFunc func(key string, defaultValue ...bool) bool
SetFunc func(key string, value interface{}) error
SetContextValueFunc func(key string, value interface{}) error
SaveConfigFunc func(path string) error
GetFunc func(key string) interface{}
SetDefaultFunc func(context Context) error
GetConfigFunc func() *Context
}
MockConfigHandler is a mock implementation of the ConfigHandler interface
func NewMockConfigHandler ¶
func NewMockConfigHandler() *MockConfigHandler
NewMockConfigHandler is a constructor for MockConfigHandler
func (*MockConfigHandler) Get ¶
func (m *MockConfigHandler) Get(key string) interface{}
Get calls the mock GetFunc if set, otherwise returns a reasonable default value
func (*MockConfigHandler) GetBool ¶
func (m *MockConfigHandler) GetBool(key string, defaultValue ...bool) bool
GetBool calls the mock GetBoolFunc if set, otherwise returns a reasonable default bool
func (*MockConfigHandler) GetConfig ¶
func (m *MockConfigHandler) GetConfig() *Context
GetConfig calls the mock GetConfigFunc if set, otherwise returns a reasonable default Context
func (*MockConfigHandler) GetInt ¶
func (m *MockConfigHandler) GetInt(key string, defaultValue ...int) int
GetInt calls the mock GetIntFunc if set, otherwise returns a reasonable default int
func (*MockConfigHandler) GetString ¶
func (m *MockConfigHandler) GetString(key string, defaultValue ...string) string
GetString calls the mock GetStringFunc if set, otherwise returns a reasonable default string
func (*MockConfigHandler) LoadConfig ¶
func (m *MockConfigHandler) LoadConfig(path string) error
LoadConfig calls the mock LoadConfigFunc if set, otherwise returns nil
func (*MockConfigHandler) SaveConfig ¶
func (m *MockConfigHandler) SaveConfig(path string) error
SaveConfig calls the mock SaveConfigFunc if set, otherwise returns nil
func (*MockConfigHandler) Set ¶
func (m *MockConfigHandler) Set(key string, value interface{}) error
Set calls the mock SetFunc if set, otherwise returns nil
func (*MockConfigHandler) SetContextValue ¶
func (m *MockConfigHandler) SetContextValue(key string, value interface{}) error
SetContextValue calls the mock SetContextValueFunc if set, otherwise returns nil
func (*MockConfigHandler) SetDefault ¶
func (m *MockConfigHandler) SetDefault(context Context) error
SetDefault calls the mock SetDefaultFunc if set, otherwise does nothing
type NodeConfig ¶
type NodeConfig struct {
Hostname *string `yaml:"hostname"`
Node *string `yaml:"node"`
Endpoint *string `yaml:"endpoint"`
}
NodeConfig represents the node configuration
type TerraformConfig ¶
type TerraformConfig struct {
Backend *string `yaml:"backend"`
}
TerraformConfig represents the Terraform configuration
type VMConfig ¶
type VMConfig struct {
Address *string `yaml:"address"`
Arch *string `yaml:"arch"`
CPU *int `yaml:"cpu"`
Disk *int `yaml:"disk"`
Driver *string `yaml:"driver"`
Memory *int `yaml:"memory"`
}
VMConfig represents the VM configuration
type YamlConfigHandler ¶
type YamlConfigHandler struct {
ConfigHandler
// contains filtered or unexported fields
}
YamlConfigHandler implements the ConfigHandler interface using goccy/go-yaml
func NewYamlConfigHandler ¶
func NewYamlConfigHandler() *YamlConfigHandler
NewYamlConfigHandler is a constructor for YamlConfigHandler that accepts a path
func (*YamlConfigHandler) Get ¶
func (y *YamlConfigHandler) Get(path string) interface{}
Get retrieves the value at the specified path in the configuration
func (*YamlConfigHandler) GetBool ¶
func (y *YamlConfigHandler) GetBool(key string, defaultValue ...bool) bool
GetBool retrieves a boolean value for the specified key from the configuration
func (*YamlConfigHandler) GetConfig ¶
func (y *YamlConfigHandler) GetConfig() *Context
GetConfig returns the context config object for the current context
func (*YamlConfigHandler) GetInt ¶
func (y *YamlConfigHandler) GetInt(key string, defaultValue ...int) int
GetInt retrieves an integer value for the specified key from the configuration
func (*YamlConfigHandler) GetString ¶
func (y *YamlConfigHandler) GetString(key string, defaultValue ...string) string
GetString retrieves a string value for the specified key from the configuration
func (*YamlConfigHandler) LoadConfig ¶
func (y *YamlConfigHandler) LoadConfig(path string) error
LoadConfig loads the configuration from the specified path
func (*YamlConfigHandler) SaveConfig ¶
func (y *YamlConfigHandler) SaveConfig(path string) error
SaveConfig saves the current configuration to the specified path
func (*YamlConfigHandler) Set ¶
func (y *YamlConfigHandler) Set(path string, value interface{}) error
Set updates the value at the specified path in the configuration
func (*YamlConfigHandler) SetContextValue ¶
func (y *YamlConfigHandler) SetContextValue(path string, value interface{}) error
SetContextValue sets a configuration value within the current context
func (*YamlConfigHandler) SetDefault ¶
func (y *YamlConfigHandler) SetDefault(context Context) error
SetDefault sets the default context configuration