config

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider    string                    `yaml:"provider"`
	Regions     []string                  `yaml:"regions"`
	Credentials map[string]string         `yaml:"credentials,omitempty"`
	Settings    Settings                  `yaml:"settings"`
	Providers   map[string]ProviderConfig `yaml:"providers,omitempty"`
	Discovery   DiscoveryConfig           `yaml:"discovery,omitempty"`
}

Config represents the complete DriftMgr configuration

type DatabaseSettings

type DatabaseSettings struct {
	Enabled bool   `yaml:"enabled"`
	Path    string `yaml:"path"`
	Backup  bool   `yaml:"backup"`
}

DatabaseSettings represents database settings

type DiscoveryConfig added in v1.1.0

type DiscoveryConfig struct {
	MaxConcurrency int           `json:"max_concurrency"`
	Timeout        int           `json:"timeout"` // seconds
	RetryCount     int           `json:"retry_count"`
	RetryDelay     time.Duration `json:"retry_delay"`
	CacheTTL       int           `json:"cache_ttl"` // seconds
}

DiscoveryConfig represents discovery configuration

type DriftSettings

type DriftSettings struct {
	Enabled  bool   `yaml:"enabled"`
	Interval string `yaml:"interval"`
	Severity string `yaml:"severity"`
}

DriftSettings represents drift detection settings

type EmailSettings

type EmailSettings struct {
	Enabled  bool     `yaml:"enabled"`
	SMTPHost string   `yaml:"smtp_host"`
	SMTPPort int      `yaml:"smtp_port"`
	From     string   `yaml:"from"`
	To       []string `yaml:"to"`
}

EmailSettings represents email notification settings

type LoggingSettings

type LoggingSettings struct {
	Level  string `yaml:"level"`
	File   string `yaml:"file"`
	Format string `yaml:"format"`
}

LoggingSettings represents logging settings

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages configuration with hot reload capability

func NewManager

func NewManager(configPath string) (*Manager, error)

NewManager creates a new configuration manager

func (*Manager) Get

func (m *Manager) Get() *Config

Get returns the current configuration

func (*Manager) GetSetting

func (m *Manager) GetSetting(path string) interface{}

GetSetting returns a specific setting value

func (*Manager) Load

func (m *Manager) Load() error

Load loads or reloads the configuration from file

func (*Manager) OnChange

func (m *Manager) OnChange(callback func(*Config))

OnChange registers a callback for configuration changes

func (*Manager) Save

func (m *Manager) Save() error

Save saves the current configuration to file

func (*Manager) Set

func (m *Manager) Set(path string, value interface{}) error

Set updates a configuration value

func (*Manager) Stop

func (m *Manager) Stop()

Stop stops the configuration manager

type NotificationSettings

type NotificationSettings struct {
	Enabled  bool              `yaml:"enabled"`
	Channels []string          `yaml:"channels"`
	Webhooks map[string]string `yaml:"webhooks,omitempty"`
	Email    EmailSettings     `yaml:"email,omitempty"`
	Slack    SlackSettings     `yaml:"slack,omitempty"`
}

NotificationSettings represents notification settings

type ProviderConfig

type ProviderConfig struct {
	Type          string            `yaml:"type,omitempty"`
	Region        string            `yaml:"region,omitempty"`
	Enabled       bool              `yaml:"enabled,omitempty"`
	Regions       []string          `yaml:"regions"`
	Credentials   map[string]string `yaml:"credentials,omitempty"`
	ResourceTypes []string          `yaml:"resource_types,omitempty"`
	ExcludeTags   map[string]string `yaml:"exclude_tags,omitempty"`
	IncludeTags   map[string]string `yaml:"include_tags,omitempty"`
}

ProviderConfig represents provider-specific configuration

type RemediationSettings

type RemediationSettings struct {
	Enabled          bool `yaml:"enabled"`
	DryRun           bool `yaml:"dry_run"`
	ApprovalRequired bool `yaml:"approval_required"`
	MaxRetries       int  `yaml:"max_retries"`
}

RemediationSettings represents remediation settings

type Settings

type Settings struct {
	AutoDiscovery   bool                 `yaml:"auto_discovery"`
	ParallelWorkers int                  `yaml:"parallel_workers"`
	CacheTTL        string               `yaml:"cache_ttl"`
	DriftDetection  DriftSettings        `yaml:"drift_detection"`
	Remediation     RemediationSettings  `yaml:"remediation"`
	Database        DatabaseSettings     `yaml:"database"`
	Logging         LoggingSettings      `yaml:"logging"`
	Notifications   NotificationSettings `yaml:"notifications"`
}

Settings represents application settings

type SlackSettings

type SlackSettings struct {
	Enabled    bool   `yaml:"enabled"`
	WebhookURL string `yaml:"webhook_url"`
	Channel    string `yaml:"channel"`
	Username   string `yaml:"username"`
}

SlackSettings represents Slack notification settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL