feat(config): add config-as-code YAML import/export
Add declarative config-as-code support via YAML files. Monitors and alerts can be exported, version controlled, and applied across instances. - goupkeep export [-o file.yaml] dumps current state - goupkeep apply -f file.yaml creates/updates to match desired state - --dry-run shows planned changes without applying - --prune deletes monitors/alerts not in the YAML - Matching by name, alert references by name, nested group children - CLI refactored to subcommands (apply, export, serve) with backward compat - 24 tests covering apply, export, validation, round-trip idempotency
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
type File struct {
|
||||
Alerts []Alert `yaml:"alerts,omitempty"`
|
||||
Monitors []Monitor `yaml:"monitors,omitempty"`
|
||||
}
|
||||
|
||||
type Alert struct {
|
||||
Name string `yaml:"name"`
|
||||
Type string `yaml:"type"`
|
||||
Settings map[string]string `yaml:"settings"`
|
||||
}
|
||||
|
||||
type Monitor struct {
|
||||
Name string `yaml:"name"`
|
||||
Type string `yaml:"type"`
|
||||
URL string `yaml:"url,omitempty"`
|
||||
Interval int `yaml:"interval,omitempty"`
|
||||
Alert string `yaml:"alert,omitempty"`
|
||||
CheckSSL bool `yaml:"check_ssl,omitempty"`
|
||||
ExpiryThreshold int `yaml:"expiry_threshold,omitempty"`
|
||||
MaxRetries int `yaml:"max_retries,omitempty"`
|
||||
Hostname string `yaml:"hostname,omitempty"`
|
||||
Port int `yaml:"port,omitempty"`
|
||||
Timeout int `yaml:"timeout,omitempty"`
|
||||
Method string `yaml:"method,omitempty"`
|
||||
Description string `yaml:"description,omitempty"`
|
||||
AcceptedCodes string `yaml:"accepted_codes,omitempty"`
|
||||
DNSResolveType string `yaml:"dns_resolve_type,omitempty"`
|
||||
DNSServer string `yaml:"dns_server,omitempty"`
|
||||
IgnoreTLS bool `yaml:"ignore_tls,omitempty"`
|
||||
Paused bool `yaml:"paused,omitempty"`
|
||||
Monitors []Monitor `yaml:"monitors,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user