Documentation
¶
Overview ¶
Package config provides functionality for managing provider configurations.
Package config provides functionality for managing provider configurations.
Package config provides functionality for managing provider configurations.
Index ¶
- func DecryptConfig(inputFile, outputFile, passphrase string) error
- func DecryptData(ciphertext []byte, passphrase string) ([]byte, error)
- func EncryptConfig(inputFile, outputFile, passphrase string) error
- func EncryptData(plaintext []byte, passphrase string) ([]byte, error)
- func GenerateEncryptionKey() ([]byte, error)
- type ConfigHistory
- type ConfigHistoryFile
- type ConfigManager
- func (m *ConfigManager) AddConfigVersion(providerType core.ProviderType, changes string) error
- func (m *ConfigManager) DecryptSensitiveData(config *core.ProviderConfig) error
- func (m *ConfigManager) DeleteConfig(providerType core.ProviderType) error
- func (m *ConfigManager) EncryptSensitiveData(config *core.ProviderConfig) error
- func (m *ConfigManager) GetAllConfigHistory() map[core.ProviderType]*ConfigHistory
- func (m *ConfigManager) GetAllConfigs() map[core.ProviderType]*core.ProviderConfig
- func (m *ConfigManager) GetAllProviderTypes() []core.ProviderType
- func (m *ConfigManager) GetConfig(providerType core.ProviderType) (*core.ProviderConfig, error)
- func (m *ConfigManager) GetConfigHistory(providerType core.ProviderType) (*ConfigHistory, error)
- func (m *ConfigManager) GetConfigVersion(providerType core.ProviderType, version int) (*ConfigVersion, error)
- func (m *ConfigManager) GetConfigVersions(providerType core.ProviderType) ([]ConfigVersion, error)
- func (m *ConfigManager) Load() error
- func (m *ConfigManager) LoadFromEnv() error
- func (m *ConfigManager) LoadHistory() error
- func (m *ConfigManager) RollbackConfig(providerType core.ProviderType, version int) error
- func (m *ConfigManager) Save() error
- func (m *ConfigManager) SaveHistory() error
- func (m *ConfigManager) SetConfig(providerType core.ProviderType, config *core.ProviderConfig) error
- func (m *ConfigManager) SetConfigFile(configFile string)
- func (m *ConfigManager) SetEncryptionKey(encryptionKey []byte)
- func (m *ConfigManager) SetEnvVarPrefix(envVarPrefix string)
- func (m *ConfigManager) SetProviderAPIKey(providerType core.ProviderType, apiKey string) error
- func (m *ConfigManager) UpdateConfig(providerType core.ProviderType, updates *core.ProviderConfig) error
- func (m *ConfigManager) UpdateEncrypt()
- func (m *ConfigManager) ValidateConfig(config *core.ProviderConfig) error
- type ConfigVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptConfig ¶
DecryptConfig decrypts a configuration file
func DecryptData ¶
DecryptData decrypts data using AES-GCM
func EncryptConfig ¶
EncryptConfig encrypts a configuration file
func EncryptData ¶
EncryptData encrypts data using AES-GCM
func GenerateEncryptionKey ¶
GenerateEncryptionKey generates a random encryption key
Types ¶
type ConfigHistory ¶
type ConfigHistory struct {
// Current is the current version
Current int `json:"current"`
// Versions is a map of version numbers to versions
Versions map[int]ConfigVersion `json:"versions"`
}
ConfigHistory represents the history of configuration changes
type ConfigHistoryFile ¶
type ConfigHistoryFile struct {
// History is a map of provider types to configuration history
History map[string]*ConfigHistory `json:"history"`
}
ConfigHistoryFile represents the file where configuration history is stored
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager is responsible for managing provider configurations
func NewConfigManager ¶
func NewConfigManager(configFile string, encryptionKey []byte, envVarPrefix string) (*ConfigManager, error)
NewConfigManager creates a new configuration manager
func (*ConfigManager) AddConfigVersion ¶
func (m *ConfigManager) AddConfigVersion(providerType core.ProviderType, changes string) error
AddConfigVersion adds a new version to the configuration history
func (*ConfigManager) DecryptSensitiveData ¶
func (m *ConfigManager) DecryptSensitiveData(config *core.ProviderConfig) error
DecryptSensitiveData decrypts sensitive data in a provider configuration
func (*ConfigManager) DeleteConfig ¶
func (m *ConfigManager) DeleteConfig(providerType core.ProviderType) error
DeleteConfig deletes the configuration for a provider type
func (*ConfigManager) EncryptSensitiveData ¶
func (m *ConfigManager) EncryptSensitiveData(config *core.ProviderConfig) error
EncryptSensitiveData encrypts sensitive data in a provider configuration
func (*ConfigManager) GetAllConfigHistory ¶
func (m *ConfigManager) GetAllConfigHistory() map[core.ProviderType]*ConfigHistory
GetAllConfigHistory returns the configuration history for all providers
func (*ConfigManager) GetAllConfigs ¶
func (m *ConfigManager) GetAllConfigs() map[core.ProviderType]*core.ProviderConfig
GetAllConfigs returns all configurations
func (*ConfigManager) GetAllProviderTypes ¶
func (m *ConfigManager) GetAllProviderTypes() []core.ProviderType
GetAllProviderTypes returns all provider types with configurations
func (*ConfigManager) GetConfig ¶
func (m *ConfigManager) GetConfig(providerType core.ProviderType) (*core.ProviderConfig, error)
GetConfig returns the configuration for a provider type
func (*ConfigManager) GetConfigHistory ¶
func (m *ConfigManager) GetConfigHistory(providerType core.ProviderType) (*ConfigHistory, error)
GetConfigHistory returns the configuration history for a provider type
func (*ConfigManager) GetConfigVersion ¶
func (m *ConfigManager) GetConfigVersion(providerType core.ProviderType, version int) (*ConfigVersion, error)
GetConfigVersion returns a specific version of a provider configuration
func (*ConfigManager) GetConfigVersions ¶
func (m *ConfigManager) GetConfigVersions(providerType core.ProviderType) ([]ConfigVersion, error)
GetConfigVersions returns all versions of a provider configuration
func (*ConfigManager) Load ¶
func (m *ConfigManager) Load() error
Load loads configurations from the configuration file
func (*ConfigManager) LoadFromEnv ¶
func (m *ConfigManager) LoadFromEnv() error
LoadFromEnv loads configurations from environment variables
func (*ConfigManager) LoadHistory ¶
func (m *ConfigManager) LoadHistory() error
LoadHistory loads configuration history from file
func (*ConfigManager) RollbackConfig ¶
func (m *ConfigManager) RollbackConfig(providerType core.ProviderType, version int) error
RollbackConfig rolls back a provider configuration to a specific version
func (*ConfigManager) Save ¶
func (m *ConfigManager) Save() error
Save saves configurations to the configuration file
func (*ConfigManager) SaveHistory ¶
func (m *ConfigManager) SaveHistory() error
SaveHistory saves configuration history to file
func (*ConfigManager) SetConfig ¶
func (m *ConfigManager) SetConfig(providerType core.ProviderType, config *core.ProviderConfig) error
SetConfig sets the configuration for a provider type
func (*ConfigManager) SetConfigFile ¶
func (m *ConfigManager) SetConfigFile(configFile string)
SetConfigFile sets the configuration file path
func (*ConfigManager) SetEncryptionKey ¶
func (m *ConfigManager) SetEncryptionKey(encryptionKey []byte)
SetEncryptionKey sets the encryption key
func (*ConfigManager) SetEnvVarPrefix ¶
func (m *ConfigManager) SetEnvVarPrefix(envVarPrefix string)
SetEnvVarPrefix sets the environment variable prefix
func (*ConfigManager) SetProviderAPIKey ¶
func (m *ConfigManager) SetProviderAPIKey(providerType core.ProviderType, apiKey string) error
SetProviderAPIKey sets the API key for a provider
func (*ConfigManager) UpdateConfig ¶
func (m *ConfigManager) UpdateConfig(providerType core.ProviderType, updates *core.ProviderConfig) error
UpdateConfig updates the configuration for a provider type
func (*ConfigManager) UpdateEncrypt ¶
func (m *ConfigManager) UpdateEncrypt()
UpdateEncrypt updates the encrypt function in the ConfigManager
func (*ConfigManager) ValidateConfig ¶
func (m *ConfigManager) ValidateConfig(config *core.ProviderConfig) error
ValidateConfig validates a provider configuration
type ConfigVersion ¶
type ConfigVersion struct {
// Version is the version number
Version int `json:"version"`
// Timestamp is the timestamp of the version
Timestamp time.Time `json:"timestamp"`
// Changes is a description of the changes
Changes string `json:"changes,omitempty"`
}
ConfigVersion represents a version of the configuration