config

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 15 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptConfig

func DecryptConfig(inputFile, outputFile, passphrase string) error

DecryptConfig decrypts a configuration file

func DecryptData

func DecryptData(ciphertext []byte, passphrase string) ([]byte, error)

DecryptData decrypts data using AES-GCM

func EncryptConfig

func EncryptConfig(inputFile, outputFile, passphrase string) error

EncryptConfig encrypts a configuration file

func EncryptData

func EncryptData(plaintext []byte, passphrase string) ([]byte, error)

EncryptData encrypts data using AES-GCM

func GenerateEncryptionKey

func GenerateEncryptionKey() ([]byte, error)

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

Jump to

Keyboard shortcuts

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