Documentation
¶
Index ¶
- Constants
- Variables
- func AllowEmpty() configcore.GetOption
- func ExpandSecretReferences(ctx context.Context, data map[string]interface{}, ...) (map[string]interface{}, error)
- func ExtractSecretKey(reference string) string
- func IsSecretReference(value string) bool
- func WithCacheKey(key string) configcore.GetOption
- func WithDefault(value interface{}) configcore.GetOption
- func WithOnMissing(fn func(string) interface{}) configcore.GetOption
- func WithRequired() configcore.GetOption
- func WithTransform(fn func(interface{}) interface{}) configcore.GetOption
- func WithValidator(fn func(interface{}) error) configcore.GetOption
- type CachedSecret
- type ChangeDetector
- type ChangeType
- type ConfigChange
- type ConfigManager
- type ConfigSource
- type ConfigSourceFactory
- type ConfigSourceOptions
- type ConstraintRule
- type DebounceWatcher
- type DefaultChangeDetector
- type DurationRule
- type EmailRule
- type EnvironmentSecretProvider
- func (esp *EnvironmentSecretProvider) Close(ctx context.Context) error
- func (esp *EnvironmentSecretProvider) DeleteSecret(ctx context.Context, key string) error
- func (esp *EnvironmentSecretProvider) GetSecret(ctx context.Context, key string) (string, error)
- func (esp *EnvironmentSecretProvider) HealthCheck(ctx context.Context) error
- func (esp *EnvironmentSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
- func (esp *EnvironmentSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
- func (esp *EnvironmentSecretProvider) Name() string
- func (esp *EnvironmentSecretProvider) SetSecret(ctx context.Context, key, value string) error
- func (esp *EnvironmentSecretProvider) SupportsCaching() bool
- func (esp *EnvironmentSecretProvider) SupportsRotation() bool
- type FileSecretProvider
- func (fsp *FileSecretProvider) Close(ctx context.Context) error
- func (fsp *FileSecretProvider) DeleteSecret(ctx context.Context, key string) error
- func (fsp *FileSecretProvider) GetSecret(ctx context.Context, key string) (string, error)
- func (fsp *FileSecretProvider) HealthCheck(ctx context.Context) error
- func (fsp *FileSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
- func (fsp *FileSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
- func (fsp *FileSecretProvider) Name() string
- func (fsp *FileSecretProvider) SetSecret(ctx context.Context, key, value string) error
- func (fsp *FileSecretProvider) SupportsCaching() bool
- func (fsp *FileSecretProvider) SupportsRotation() bool
- type FileWatcher
- type ForgeError
- type HealthCall
- type LifecycleCall
- type ListCall
- type Manager
- func (m *Manager) AllKeys() []string
- func (m *Manager) AllSettings() map[string]interface{}
- func (m *Manager) Bind(key string, target interface{}) error
- func (m *Manager) BindWithDefault(key string, target interface{}, defaultValue interface{}) error
- func (m *Manager) BindWithOptions(key string, target interface{}, options configcore.BindOptions) error
- func (m *Manager) Clone() ConfigManager
- func (m *Manager) ConfigFileUsed() string
- func (m *Manager) ExpandEnvVars() error
- func (m *Manager) Get(key string) interface{}
- func (m *Manager) GetAllSettings() map[string]interface{}
- func (m *Manager) GetBool(key string, defaultValue ...bool) bool
- func (m *Manager) GetBoolSlice(key string, defaultValue ...[]bool) []bool
- func (m *Manager) GetBoolWithOptions(key string, opts ...configcore.GetOption) (bool, error)
- func (m *Manager) GetBytesSize(key string, defaultValue ...uint64) uint64
- func (m *Manager) GetDuration(key string, defaultValue ...time.Duration) time.Duration
- func (m *Manager) GetDurationWithOptions(key string, opts ...configcore.GetOption) (time.Duration, error)
- func (m *Manager) GetFloat32(key string, defaultValue ...float32) float32
- func (m *Manager) GetFloat64(key string, defaultValue ...float64) float64
- func (m *Manager) GetFloat64Slice(key string, defaultValue ...[]float64) []float64
- func (m *Manager) GetInt(key string, defaultValue ...int) int
- func (m *Manager) GetInt16(key string, defaultValue ...int16) int16
- func (m *Manager) GetInt32(key string, defaultValue ...int32) int32
- func (m *Manager) GetInt64(key string, defaultValue ...int64) int64
- func (m *Manager) GetInt64Slice(key string, defaultValue ...[]int64) []int64
- func (m *Manager) GetInt8(key string, defaultValue ...int8) int8
- func (m *Manager) GetIntSlice(key string, defaultValue ...[]int) []int
- func (m *Manager) GetIntWithOptions(key string, opts ...configcore.GetOption) (int, error)
- func (m *Manager) GetKeys() []string
- func (m *Manager) GetSection(key string) map[string]interface{}
- func (m *Manager) GetSizeInBytes(key string, defaultValue ...uint64) uint64
- func (m *Manager) GetSourceMetadata() map[string]*SourceMetadata
- func (m *Manager) GetString(key string, defaultValue ...string) string
- func (m *Manager) GetStringMap(key string, defaultValue ...map[string]string) map[string]string
- func (m *Manager) GetStringMapString(key string, defaultValue ...map[string]string) map[string]string
- func (m *Manager) GetStringMapStringSlice(key string, defaultValue ...map[string][]string) map[string][]string
- func (m *Manager) GetStringSlice(key string, defaultValue ...[]string) []string
- func (m *Manager) GetStringWithOptions(key string, opts ...configcore.GetOption) (string, error)
- func (m *Manager) GetTime(key string, defaultValue ...time.Time) time.Time
- func (m *Manager) GetUint(key string, defaultValue ...uint) uint
- func (m *Manager) GetUint16(key string, defaultValue ...uint16) uint16
- func (m *Manager) GetUint32(key string, defaultValue ...uint32) uint32
- func (m *Manager) GetUint64(key string, defaultValue ...uint64) uint64
- func (m *Manager) GetUint8(key string, defaultValue ...uint8) uint8
- func (m *Manager) GetWithOptions(key string, opts ...configcore.GetOption) (interface{}, error)
- func (m *Manager) HasKey(key string) bool
- func (m *Manager) InConfig(key string) bool
- func (m *Manager) IsSet(key string) bool
- func (m *Manager) LoadFrom(sources ...ConfigSource) error
- func (m *Manager) MergeWith(other ConfigManager) error
- func (m *Manager) Name() string
- func (m *Manager) OnConfigChange(callback func(ConfigChange))
- func (m *Manager) ReadInConfig() error
- func (m *Manager) Reload() error
- func (m *Manager) ReloadContext(ctx context.Context) error
- func (m *Manager) Reset()
- func (m *Manager) SafeGet(key string, expectedType reflect.Type) (interface{}, error)
- func (m *Manager) SecretsManager() SecretsManager
- func (m *Manager) Set(key string, value interface{})
- func (m *Manager) SetConfigFile(filePath string) error
- func (m *Manager) SetConfigType(configType string)
- func (m *Manager) Size() int
- func (m *Manager) Stop() error
- func (m *Manager) Sub(key string) ConfigManager
- func (m *Manager) Unmarshal(rawVal interface{}) error
- func (m *Manager) UnmarshalKey(key string, rawVal interface{}) error
- func (m *Manager) Validate() error
- func (m *Manager) Watch(ctx context.Context) error
- func (m *Manager) WatchChanges(callback func(ConfigChange))
- func (m *Manager) WatchConfig() error
- func (m *Manager) WatchWithCallback(key string, callback func(string, interface{}))
- type ManagerConfig
- type MemorySecretProvider
- func (msp *MemorySecretProvider) Close(ctx context.Context) error
- func (msp *MemorySecretProvider) DeleteSecret(ctx context.Context, key string) error
- func (msp *MemorySecretProvider) GetSecret(ctx context.Context, key string) (string, error)
- func (msp *MemorySecretProvider) HealthCheck(ctx context.Context) error
- func (msp *MemorySecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
- func (msp *MemorySecretProvider) ListSecrets(ctx context.Context) ([]string, error)
- func (msp *MemorySecretProvider) Name() string
- func (msp *MemorySecretProvider) SetSecret(ctx context.Context, key, value string) error
- func (msp *MemorySecretProvider) SupportsCaching() bool
- func (msp *MemorySecretProvider) SupportsRotation() bool
- type MockSecretsBuilder
- func (b *MockSecretsBuilder) Build() *MockSecretsManager
- func (b *MockSecretsBuilder) WithGetError(err error) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithLatency(latency time.Duration) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithProvider(name string, provider SecretProvider) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithSecret(key, value string) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithSecrets(secrets map[string]string) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithSetError(err error) *MockSecretsBuilder
- func (b *MockSecretsBuilder) WithStarted(started bool) *MockSecretsBuilder
- type MockSecretsManager
- func (m *MockSecretsManager) ClearErrors()
- func (m *MockSecretsManager) DeleteCallCount() int
- func (m *MockSecretsManager) DeleteCalls() []SecretCall
- func (m *MockSecretsManager) DeleteSecret(ctx context.Context, key string) error
- func (m *MockSecretsManager) ErrorCount() int64
- func (m *MockSecretsManager) GetCallCount() int
- func (m *MockSecretsManager) GetCalls() []SecretCall
- func (m *MockSecretsManager) GetProvider(name string) (SecretProvider, error)
- func (m *MockSecretsManager) GetSecret(ctx context.Context, key string) (string, error)
- func (m *MockSecretsManager) GetStats() MockStats
- func (m *MockSecretsManager) HealthCallCount() int
- func (m *MockSecretsManager) HealthCalls() []HealthCall
- func (m *MockSecretsManager) HealthCheck(ctx context.Context) error
- func (m *MockSecretsManager) IsStarted() bool
- func (m *MockSecretsManager) LastAccessed() time.Time
- func (m *MockSecretsManager) ListCallCount() int
- func (m *MockSecretsManager) ListCalls() []ListCall
- func (m *MockSecretsManager) ListSecrets(ctx context.Context) ([]string, error)
- func (m *MockSecretsManager) PrintStats()
- func (m *MockSecretsManager) ProviderCount() int
- func (m *MockSecretsManager) RefreshCallCount() int
- func (m *MockSecretsManager) RefreshCalls() []RefreshCall
- func (m *MockSecretsManager) RefreshSecrets(ctx context.Context) error
- func (m *MockSecretsManager) RegisterProvider(name string, provider SecretProvider) error
- func (m *MockSecretsManager) Reset()
- func (m *MockSecretsManager) ResetCallTracking()
- func (m *MockSecretsManager) RotateCallCount() int
- func (m *MockSecretsManager) RotateCalls() []RotateCall
- func (m *MockSecretsManager) RotateSecret(ctx context.Context, key, newValue string) error
- func (m *MockSecretsManager) SecretCount() int
- func (m *MockSecretsManager) SetCallCount() int
- func (m *MockSecretsManager) SetCalls() []SecretCall
- func (m *MockSecretsManager) SetDeleteError(err error)
- func (m *MockSecretsManager) SetGetError(err error)
- func (m *MockSecretsManager) SetHealthError(err error)
- func (m *MockSecretsManager) SetLatencySimulation(latency time.Duration)
- func (m *MockSecretsManager) SetListError(err error)
- func (m *MockSecretsManager) SetRefreshError(err error)
- func (m *MockSecretsManager) SetRotateError(err error)
- func (m *MockSecretsManager) SetSecret(ctx context.Context, key, value string) error
- func (m *MockSecretsManager) SetSetError(err error)
- func (m *MockSecretsManager) SetStartError(err error)
- func (m *MockSecretsManager) SetStopError(err error)
- func (m *MockSecretsManager) Start(ctx context.Context) error
- func (m *MockSecretsManager) StartCallCount() int
- func (m *MockSecretsManager) StartCalls() []LifecycleCall
- func (m *MockSecretsManager) Stop(ctx context.Context) error
- func (m *MockSecretsManager) StopCallCount() int
- func (m *MockSecretsManager) StopCalls() []LifecycleCall
- func (m *MockSecretsManager) TotalCallCount() int64
- func (m *MockSecretsManager) WasDeleteCalledWith(key string) bool
- func (m *MockSecretsManager) WasGetCalledWith(key string) bool
- func (m *MockSecretsManager) WasRotateCalledWith(key string) bool
- func (m *MockSecretsManager) WasSetCalledWith(key, value string) bool
- type MockStats
- type PortRule
- type PropertySchema
- type PropertyType
- type ProviderConfig
- type RefreshCall
- type RotateCall
- type SecretCall
- type SecretEncryptor
- type SecretGenerator
- type SecretMetadata
- type SecretProvider
- type SecretRotationPolicy
- type SecretValidator
- type SecretsConfig
- type SecretsManager
- type SecretsManagerImpl
- func (sm *SecretsManagerImpl) DeleteSecret(ctx context.Context, key string) error
- func (sm *SecretsManagerImpl) GetProvider(name string) (SecretProvider, error)
- func (sm *SecretsManagerImpl) GetSecret(ctx context.Context, key string) (string, error)
- func (sm *SecretsManagerImpl) HealthCheck(ctx context.Context) error
- func (sm *SecretsManagerImpl) ListSecrets(ctx context.Context) ([]string, error)
- func (sm *SecretsManagerImpl) RefreshSecrets(ctx context.Context) error
- func (sm *SecretsManagerImpl) RegisterProvider(name string, provider SecretProvider) error
- func (sm *SecretsManagerImpl) RotateSecret(ctx context.Context, key, newValue string) error
- func (sm *SecretsManagerImpl) SetSecret(ctx context.Context, key, value string) error
- func (sm *SecretsManagerImpl) Start(ctx context.Context) error
- func (sm *SecretsManagerImpl) Stop(ctx context.Context) error
- type Severity
- type SourceConfig
- type SourceEvent
- type SourceEventHandler
- type SourceMetadata
- type SourceRegistry
- type SourceRegistryImpl
- func (sr *SourceRegistryImpl) Clear() error
- func (sr *SourceRegistryImpl) GetAllMetadata() map[string]*SourceMetadata
- func (sr *SourceRegistryImpl) GetSource(name string) (ConfigSource, error)
- func (sr *SourceRegistryImpl) GetSourceMetadata(name string) (*SourceMetadata, error)
- func (sr *SourceRegistryImpl) GetSourceNames() []string
- func (sr *SourceRegistryImpl) GetSourceStats() map[string]interface{}
- func (sr *SourceRegistryImpl) GetSources() []ConfigSource
- func (sr *SourceRegistryImpl) GetSourcesByType(sourceType string) []ConfigSource
- func (sr *SourceRegistryImpl) GetSourcesWithSecrets() []ConfigSource
- func (sr *SourceRegistryImpl) GetWatchableSources() []ConfigSource
- func (sr *SourceRegistryImpl) HasSource(name string) bool
- func (sr *SourceRegistryImpl) IsEmpty() bool
- func (sr *SourceRegistryImpl) RegisterSource(source ConfigSource) error
- func (sr *SourceRegistryImpl) UnregisterSource(name string) error
- func (sr *SourceRegistryImpl) UpdateLoadStats(name string, keyCount int, err error) error
- func (sr *SourceRegistryImpl) UpdateModifiedTime(name string, modifiedTime time.Time) error
- func (sr *SourceRegistryImpl) UpdateSourceMetadata(name string, updater func(*SourceMetadata)) error
- func (sr *SourceRegistryImpl) UpdateWatchStatus(name string, isWatching bool) error
- func (sr *SourceRegistryImpl) ValidateSourceDependencies() error
- type TestConfigAssertions
- func (a *TestConfigAssertions) AssertIntEquals(key string, expected int) bool
- func (a *TestConfigAssertions) AssertKeyEquals(key string, expected interface{}) bool
- func (a *TestConfigAssertions) AssertKeyExists(key string) bool
- func (a *TestConfigAssertions) AssertStringEquals(key string, expected string) bool
- type TestConfigBuilder
- func (b *TestConfigBuilder) Build() ConfigManager
- func (b *TestConfigBuilder) Set(key string, value interface{}) *TestConfigBuilder
- func (b *TestConfigBuilder) SetDefaults(defaults map[string]interface{}) *TestConfigBuilder
- func (b *TestConfigBuilder) SetSection(key string, section map[string]interface{}) *TestConfigBuilder
- type TestConfigManager
- func (t *TestConfigManager) AllKeys() []string
- func (t *TestConfigManager) AllSettings() map[string]interface{}
- func (t *TestConfigManager) Bind(key string, target interface{}) error
- func (t *TestConfigManager) BindWithDefault(key string, target interface{}, defaultValue interface{}) error
- func (t *TestConfigManager) BindWithOptions(key string, target interface{}, options configcore.BindOptions) error
- func (t *TestConfigManager) Clone() ConfigManager
- func (t *TestConfigManager) ConfigFileUsed() string
- func (t *TestConfigManager) ExpandEnvVars() error
- func (t *TestConfigManager) Get(key string) interface{}
- func (t *TestConfigManager) GetAllSettings() map[string]interface{}
- func (t *TestConfigManager) GetBool(key string, defaultValue ...bool) bool
- func (t *TestConfigManager) GetBoolSlice(key string, defaultValue ...[]bool) []bool
- func (t *TestConfigManager) GetBoolWithOptions(key string, opts ...configcore.GetOption) (bool, error)
- func (t *TestConfigManager) GetBytesSize(key string, defaultValue ...uint64) uint64
- func (t *TestConfigManager) GetDuration(key string, defaultValue ...time.Duration) time.Duration
- func (t *TestConfigManager) GetDurationWithOptions(key string, opts ...configcore.GetOption) (time.Duration, error)
- func (t *TestConfigManager) GetFloat32(key string, defaultValue ...float32) float32
- func (t *TestConfigManager) GetFloat64(key string, defaultValue ...float64) float64
- func (t *TestConfigManager) GetFloat64Slice(key string, defaultValue ...[]float64) []float64
- func (t *TestConfigManager) GetInt(key string, defaultValue ...int) int
- func (t *TestConfigManager) GetInt16(key string, defaultValue ...int16) int16
- func (t *TestConfigManager) GetInt32(key string, defaultValue ...int32) int32
- func (t *TestConfigManager) GetInt64(key string, defaultValue ...int64) int64
- func (t *TestConfigManager) GetInt64Slice(key string, defaultValue ...[]int64) []int64
- func (t *TestConfigManager) GetInt8(key string, defaultValue ...int8) int8
- func (t *TestConfigManager) GetIntSlice(key string, defaultValue ...[]int) []int
- func (t *TestConfigManager) GetIntWithOptions(key string, opts ...configcore.GetOption) (int, error)
- func (t *TestConfigManager) GetKeys() []string
- func (t *TestConfigManager) GetSection(key string) map[string]interface{}
- func (t *TestConfigManager) GetSizeInBytes(key string, defaultValue ...uint64) uint64
- func (t *TestConfigManager) GetSourceMetadata() map[string]*SourceMetadata
- func (t *TestConfigManager) GetString(key string, defaultValue ...string) string
- func (t *TestConfigManager) GetStringMap(key string, defaultValue ...map[string]string) map[string]string
- func (t *TestConfigManager) GetStringMapString(key string, defaultValue ...map[string]string) map[string]string
- func (t *TestConfigManager) GetStringMapStringSlice(key string, defaultValue ...map[string][]string) map[string][]string
- func (t *TestConfigManager) GetStringSlice(key string, defaultValue ...[]string) []string
- func (t *TestConfigManager) GetStringWithOptions(key string, opts ...configcore.GetOption) (string, error)
- func (t *TestConfigManager) GetTime(key string, defaultValue ...time.Time) time.Time
- func (t *TestConfigManager) GetUint(key string, defaultValue ...uint) uint
- func (t *TestConfigManager) GetUint16(key string, defaultValue ...uint16) uint16
- func (t *TestConfigManager) GetUint32(key string, defaultValue ...uint32) uint32
- func (t *TestConfigManager) GetUint64(key string, defaultValue ...uint64) uint64
- func (t *TestConfigManager) GetUint8(key string, defaultValue ...uint8) uint8
- func (t *TestConfigManager) GetWithOptions(key string, opts ...configcore.GetOption) (interface{}, error)
- func (t *TestConfigManager) HasKey(key string) bool
- func (t *TestConfigManager) InConfig(key string) bool
- func (t *TestConfigManager) IsSet(key string) bool
- func (t *TestConfigManager) LoadFrom(sources ...ConfigSource) error
- func (t *TestConfigManager) MergeWith(other ConfigManager) error
- func (t *TestConfigManager) Name() string
- func (t *TestConfigManager) OnConfigChange(callback func(ConfigChange))
- func (t *TestConfigManager) ReadInConfig() error
- func (t *TestConfigManager) Reload() error
- func (t *TestConfigManager) ReloadContext(ctx context.Context) error
- func (t *TestConfigManager) Reset()
- func (t *TestConfigManager) SafeGet(key string, expectedType reflect.Type) (interface{}, error)
- func (t *TestConfigManager) SecretsManager() SecretsManager
- func (t *TestConfigManager) Set(key string, value interface{})
- func (t *TestConfigManager) SetConfigFile(filePath string) error
- func (t *TestConfigManager) SetConfigType(configType string)
- func (t *TestConfigManager) SimulateConfigChange(key string, newValue interface{})
- func (t *TestConfigManager) Size() int
- func (t *TestConfigManager) Stop() error
- func (t *TestConfigManager) Sub(key string) ConfigManager
- func (t *TestConfigManager) Unmarshal(rawVal interface{}) error
- func (t *TestConfigManager) UnmarshalKey(key string, rawVal interface{}) error
- func (t *TestConfigManager) Validate() error
- func (t *TestConfigManager) Watch(ctx context.Context) error
- func (t *TestConfigManager) WatchChanges(callback func(ConfigChange))
- func (t *TestConfigManager) WatchConfig() error
- func (t *TestConfigManager) WatchWithCallback(key string, callback func(string, interface{}))
- type URLRule
- type ValidationConfig
- type ValidationError
- type ValidationMode
- type ValidationOptions
- type ValidationResult
- type ValidationRule
- type ValidationSchema
- type ValidationWarning
- type Validator
- func (v *Validator) AddConstraint(keyPattern string, constraint ConstraintRule)
- func (v *Validator) AddRule(keyPattern string, rule ValidationRule)
- func (v *Validator) IsStrictMode() bool
- func (v *Validator) RegisterSchema(schema ValidationSchema)
- func (v *Validator) SetMode(mode ValidationMode)
- func (v *Validator) ValidateAll(config map[string]interface{}) error
- func (v *Validator) ValidateConfig(config map[string]interface{}) ValidationResult
- func (v *Validator) ValidateKey(key string, value interface{}, config map[string]interface{}) error
- type ValidatorConfig
- type VaultSecretProvider
- func (vsp *VaultSecretProvider) Close(ctx context.Context) error
- func (vsp *VaultSecretProvider) DeleteSecret(ctx context.Context, key string) error
- func (vsp *VaultSecretProvider) GetSecret(ctx context.Context, key string) (string, error)
- func (vsp *VaultSecretProvider) HealthCheck(ctx context.Context) error
- func (vsp *VaultSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
- func (vsp *VaultSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
- func (vsp *VaultSecretProvider) Name() string
- func (vsp *VaultSecretProvider) SetSecret(ctx context.Context, key, value string) error
- func (vsp *VaultSecretProvider) SupportsCaching() bool
- func (vsp *VaultSecretProvider) SupportsRotation() bool
- type WatchCallback
- type WatchContext
- type WatchEvent
- type WatchEventType
- type WatchStats
- type Watcher
- func (w *Watcher) GetAllStats() map[string]*WatchStats
- func (w *Watcher) GetSourceStats(sourceName string) (*WatchStats, error)
- func (w *Watcher) GetWatchedSources() []string
- func (w *Watcher) RegisterEventHandler(sourceName string, handler SourceEventHandler)
- func (w *Watcher) StopAll() error
- func (w *Watcher) StopWatching(sourceName string) error
- func (w *Watcher) UnregisterEventHandler(sourceName string, handler SourceEventHandler)
- func (w *Watcher) WatchSource(ctx context.Context, source ConfigSource, callback WatchCallback) error
- type WatcherConfig
Constants ¶
const ( SeverityError = errors.SeverityError SeverityWarning = errors.SeverityWarning SeverityInfo = errors.SeverityInfo )
const ConfigKey = shared.ConfigKey
ConfigKey is the service key for configuration manager
const ManagerKey = ConfigKey
Variables ¶
var ( ErrConfigError = errors.ErrConfigError ErrLifecycleError = errors.ErrLifecycleError ErrValidationError = errors.ErrValidationError )
Functions ¶
func ExpandSecretReferences ¶
func ExpandSecretReferences(ctx context.Context, data map[string]interface{}, secretsManager SecretsManager) (map[string]interface{}, error)
ExpandSecretReferences expands secret references in configuration
func ExtractSecretKey ¶
ExtractSecretKey extracts the secret key from a reference
func IsSecretReference ¶
IsSecretReference checks if a value is a secret reference
func WithCacheKey ¶
func WithCacheKey(key string) configcore.GetOption
WithCacheKey sets a custom cache key
func WithDefault ¶
func WithDefault(value interface{}) configcore.GetOption
WithDefault sets a default value
func WithOnMissing ¶
func WithOnMissing(fn func(string) interface{}) configcore.GetOption
WithOnMissing sets a callback for missing keys
func WithTransform ¶
func WithTransform(fn func(interface{}) interface{}) configcore.GetOption
WithTransform adds a transformation function
func WithValidator ¶
func WithValidator(fn func(interface{}) error) configcore.GetOption
WithValidator adds a validation function
Types ¶
type CachedSecret ¶
type CachedSecret struct {
Value string `json:"value"`
Metadata SecretMetadata `json:"metadata"`
ExpiresAt time.Time `json:"expires_at"`
Encrypted bool `json:"encrypted"`
}
CachedSecret represents a cached secret
type ChangeDetector ¶
type ChangeDetector interface {
DetectChanges(old, new map[string]interface{}) []ConfigChange
CalculateChecksum(data map[string]interface{}) string
}
ChangeDetector detects changes in configuration data
type ChangeType ¶
type ChangeType = core.ChangeType
ChangeType represents the type of configuration change
const ( ChangeTypeSet ChangeType = core.ChangeTypeSet ChangeTypeUpdate ChangeType = core.ChangeTypeUpdate ChangeTypeDelete ChangeType = core.ChangeTypeDelete ChangeTypeReload ChangeType = core.ChangeTypeReload )
type ConfigChange ¶
type ConfigChange = core.ConfigChange
ConfigChange represents a configuration change event
type ConfigManager ¶
type ConfigManager = core.ConfigManager
ConfigManager interface (matches v2.ConfigManagerInterface)
func NewManager ¶
func NewManager(config ManagerConfig) ConfigManager
NewManager creates a new enhanced configuration manager
func NewTestConfigManager ¶
func NewTestConfigManager() ConfigManager
NewTestConfigManager creates a new test configuration manager
func NewTestConfigManagerWithData ¶
func NewTestConfigManagerWithData(data map[string]interface{}) ConfigManager
NewTestConfigManagerWithData creates a test config manager with initial data
type ConfigSource ¶
type ConfigSource = core.ConfigSource
ConfigSource represents a source of configuration data
type ConfigSourceFactory ¶
type ConfigSourceFactory = core.ConfigSourceFactory
ConfigSourceFactory creates configuration sources
type ConfigSourceOptions ¶
type ConfigSourceOptions = core.ConfigSourceOptions
ConfigSourceOptions contains options for creating a configuration source
type ConstraintRule ¶
type ConstraintRule interface {
Name() string
Description() string
Validate(key string, value interface{}, config map[string]interface{}) error
AppliesTo(key string) bool
}
ConstraintRule defines a constraint that must be satisfied
type DebounceWatcher ¶
type DebounceWatcher struct {
*Watcher
// contains filtered or unexported fields
}
DebounceWatcher wraps another watcher with debouncing functionality
func NewDebounceWatcher ¶
func NewDebounceWatcher(config WatcherConfig, debounceTime time.Duration) *DebounceWatcher
NewDebounceWatcher creates a watcher with debouncing
func (*DebounceWatcher) WatchSource ¶
func (dw *DebounceWatcher) WatchSource(ctx context.Context, source ConfigSource, callback WatchCallback) error
WatchSource starts watching with debouncing
type DefaultChangeDetector ¶
type DefaultChangeDetector struct{}
DefaultChangeDetector is a simple implementation of ChangeDetector
func (*DefaultChangeDetector) CalculateChecksum ¶
func (d *DefaultChangeDetector) CalculateChecksum(data map[string]interface{}) string
func (*DefaultChangeDetector) DetectChanges ¶
func (d *DefaultChangeDetector) DetectChanges(old, new map[string]interface{}) []ConfigChange
type DurationRule ¶
type DurationRule struct{}
func (*DurationRule) AppliesTo ¶
func (r *DurationRule) AppliesTo(key string) bool
func (*DurationRule) Name ¶
func (r *DurationRule) Name() string
func (*DurationRule) Validate ¶
func (r *DurationRule) Validate(key string, value interface{}) error
type EnvironmentSecretProvider ¶
type EnvironmentSecretProvider struct {
// contains filtered or unexported fields
}
EnvironmentSecretProvider provides secrets from environment variables
func (*EnvironmentSecretProvider) Close ¶
func (esp *EnvironmentSecretProvider) Close(ctx context.Context) error
func (*EnvironmentSecretProvider) DeleteSecret ¶
func (esp *EnvironmentSecretProvider) DeleteSecret(ctx context.Context, key string) error
func (*EnvironmentSecretProvider) HealthCheck ¶
func (esp *EnvironmentSecretProvider) HealthCheck(ctx context.Context) error
func (*EnvironmentSecretProvider) Initialize ¶
func (esp *EnvironmentSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
func (*EnvironmentSecretProvider) ListSecrets ¶
func (esp *EnvironmentSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
func (*EnvironmentSecretProvider) Name ¶
func (esp *EnvironmentSecretProvider) Name() string
func (*EnvironmentSecretProvider) SetSecret ¶
func (esp *EnvironmentSecretProvider) SetSecret(ctx context.Context, key, value string) error
func (*EnvironmentSecretProvider) SupportsCaching ¶
func (esp *EnvironmentSecretProvider) SupportsCaching() bool
func (*EnvironmentSecretProvider) SupportsRotation ¶
func (esp *EnvironmentSecretProvider) SupportsRotation() bool
type FileSecretProvider ¶
type FileSecretProvider struct {
// contains filtered or unexported fields
}
FileSecretProvider provides secrets from files
func (*FileSecretProvider) DeleteSecret ¶
func (fsp *FileSecretProvider) DeleteSecret(ctx context.Context, key string) error
func (*FileSecretProvider) HealthCheck ¶
func (fsp *FileSecretProvider) HealthCheck(ctx context.Context) error
func (*FileSecretProvider) Initialize ¶
func (fsp *FileSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
func (*FileSecretProvider) ListSecrets ¶
func (fsp *FileSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
func (*FileSecretProvider) Name ¶
func (fsp *FileSecretProvider) Name() string
func (*FileSecretProvider) SetSecret ¶
func (fsp *FileSecretProvider) SetSecret(ctx context.Context, key, value string) error
func (*FileSecretProvider) SupportsCaching ¶
func (fsp *FileSecretProvider) SupportsCaching() bool
func (*FileSecretProvider) SupportsRotation ¶
func (fsp *FileSecretProvider) SupportsRotation() bool
type FileWatcher ¶
FileWatcher represents a file system watcher
type ForgeError ¶
type ForgeError = errors.ForgeError
Re-export error types and constructors for backward compatibility
type HealthCall ¶
HealthCall represents a tracked health check
type LifecycleCall ¶
LifecycleCall represents a tracked lifecycle operation
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements an enhanced configuration manager that extends ConfigManager
func (*Manager) AllSettings ¶
AllSettings is an alias for GetAllSettings
func (*Manager) BindWithDefault ¶
BindWithDefault binds with a default value
func (*Manager) BindWithOptions ¶
func (m *Manager) BindWithOptions(key string, target interface{}, options configcore.BindOptions) error
BindWithOptions binds with flexible options
func (*Manager) ConfigFileUsed ¶
ConfigFileUsed returns the config file path
func (*Manager) ExpandEnvVars ¶
ExpandEnvVars expands environment variables
func (*Manager) GetAllSettings ¶
GetAllSettings returns all settings
func (*Manager) GetBoolSlice ¶
GetBoolSlice returns a bool slice with optional default
func (*Manager) GetBoolWithOptions ¶
GetBoolWithOptions returns a bool with advanced options
func (*Manager) GetBytesSize ¶
GetBytesSize is an alias for GetSizeInBytes
func (*Manager) GetDuration ¶
GetDuration returns a duration value with optional default
func (*Manager) GetDurationWithOptions ¶
func (m *Manager) GetDurationWithOptions(key string, opts ...configcore.GetOption) (time.Duration, error)
GetDurationWithOptions returns a duration with advanced options
func (*Manager) GetFloat32 ¶
GetFloat32 returns a float32 value with optional default
func (*Manager) GetFloat64 ¶
GetFloat64 returns a float64 value with optional default
func (*Manager) GetFloat64Slice ¶
GetFloat64Slice returns a float64 slice with optional default
func (*Manager) GetInt64Slice ¶
GetInt64Slice returns an int64 slice with optional default
func (*Manager) GetIntSlice ¶
GetIntSlice returns an int slice with optional default
func (*Manager) GetIntWithOptions ¶
GetIntWithOptions returns an int with advanced options
func (*Manager) GetSection ¶
GetSection returns a configuration section
func (*Manager) GetSizeInBytes ¶
GetSizeInBytes returns size in bytes with optional default
func (*Manager) GetSourceMetadata ¶
func (m *Manager) GetSourceMetadata() map[string]*SourceMetadata
GetSourceMetadata returns metadata for all sources
func (*Manager) GetStringMap ¶
GetStringMap returns a string map with optional default
func (*Manager) GetStringMapString ¶
func (m *Manager) GetStringMapString(key string, defaultValue ...map[string]string) map[string]string
GetStringMapString is an alias for GetStringMap
func (*Manager) GetStringMapStringSlice ¶
func (m *Manager) GetStringMapStringSlice(key string, defaultValue ...map[string][]string) map[string][]string
GetStringMapStringSlice returns a map of string slices with optional default
func (*Manager) GetStringSlice ¶
GetStringSlice returns a string slice with optional default
func (*Manager) GetStringWithOptions ¶
GetStringWithOptions returns a string with advanced options
func (*Manager) GetWithOptions ¶
func (m *Manager) GetWithOptions(key string, opts ...configcore.GetOption) (interface{}, error)
GetWithOptions returns a value with advanced options
func (*Manager) LoadFrom ¶
func (m *Manager) LoadFrom(sources ...ConfigSource) error
LoadFrom loads configuration from multiple sources
func (*Manager) MergeWith ¶
func (m *Manager) MergeWith(other ConfigManager) error
MergeWith merges another config manager
func (*Manager) OnConfigChange ¶
func (m *Manager) OnConfigChange(callback func(ConfigChange))
OnConfigChange is an alias for WatchChanges
func (*Manager) ReadInConfig ¶
ReadInConfig reads configuration
func (*Manager) ReloadContext ¶
ReloadContext forces a reload with context
func (*Manager) SecretsManager ¶
func (m *Manager) SecretsManager() SecretsManager
func (*Manager) SetConfigFile ¶
SetConfigFile sets the configuration file
func (*Manager) SetConfigType ¶
SetConfigType sets the configuration type
func (*Manager) Sub ¶
func (m *Manager) Sub(key string) ConfigManager
Sub returns a sub-configuration manager
func (*Manager) UnmarshalKey ¶
UnmarshalKey is an alias for Bind
func (*Manager) WatchChanges ¶
func (m *Manager) WatchChanges(callback func(ConfigChange))
WatchChanges registers a callback for all changes
func (*Manager) WatchConfig ¶
WatchConfig is an alias for Watch
func (*Manager) WatchWithCallback ¶
WatchWithCallback registers a callback for key changes
type ManagerConfig ¶
type ManagerConfig struct {
DefaultSources []SourceConfig `yaml:"default_sources" json:"default_sources"`
WatchInterval time.Duration `yaml:"watch_interval" json:"watch_interval"`
ValidationMode ValidationMode `yaml:"validation_mode" json:"validation_mode"`
SecretsEnabled bool `yaml:"secrets_enabled" json:"secrets_enabled"`
CacheEnabled bool `yaml:"cache_enabled" json:"cache_enabled"`
ReloadOnChange bool `yaml:"reload_on_change" json:"reload_on_change"`
ErrorRetryCount int `yaml:"error_retry_count" json:"error_retry_count"`
ErrorRetryDelay time.Duration `yaml:"error_retry_delay" json:"error_retry_delay"`
MetricsEnabled bool `yaml:"metrics_enabled" json:"metrics_enabled"`
Logger logger.Logger `yaml:"-" json:"-"`
Metrics shared.Metrics `yaml:"-" json:"-"`
ErrorHandler shared.ErrorHandler `yaml:"-" json:"-"`
}
ManagerConfig contains configuration for the config manager
type MemorySecretProvider ¶
type MemorySecretProvider struct {
// contains filtered or unexported fields
}
MemorySecretProvider provides secrets from memory (for testing)
func (*MemorySecretProvider) Close ¶
func (msp *MemorySecretProvider) Close(ctx context.Context) error
func (*MemorySecretProvider) DeleteSecret ¶
func (msp *MemorySecretProvider) DeleteSecret(ctx context.Context, key string) error
func (*MemorySecretProvider) HealthCheck ¶
func (msp *MemorySecretProvider) HealthCheck(ctx context.Context) error
func (*MemorySecretProvider) Initialize ¶
func (msp *MemorySecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
func (*MemorySecretProvider) ListSecrets ¶
func (msp *MemorySecretProvider) ListSecrets(ctx context.Context) ([]string, error)
func (*MemorySecretProvider) Name ¶
func (msp *MemorySecretProvider) Name() string
func (*MemorySecretProvider) SetSecret ¶
func (msp *MemorySecretProvider) SetSecret(ctx context.Context, key, value string) error
func (*MemorySecretProvider) SupportsCaching ¶
func (msp *MemorySecretProvider) SupportsCaching() bool
func (*MemorySecretProvider) SupportsRotation ¶
func (msp *MemorySecretProvider) SupportsRotation() bool
type MockSecretsBuilder ¶
type MockSecretsBuilder struct {
// contains filtered or unexported fields
}
MockSecretsBuilder provides fluent interface for building test scenarios
func NewMockSecretsBuilder ¶
func NewMockSecretsBuilder() *MockSecretsBuilder
NewMockSecretsBuilder creates a new builder
func (*MockSecretsBuilder) Build ¶
func (b *MockSecretsBuilder) Build() *MockSecretsManager
Build returns the configured mock
func (*MockSecretsBuilder) WithGetError ¶
func (b *MockSecretsBuilder) WithGetError(err error) *MockSecretsBuilder
WithGetError configures GetSecret error
func (*MockSecretsBuilder) WithLatency ¶
func (b *MockSecretsBuilder) WithLatency(latency time.Duration) *MockSecretsBuilder
WithLatency configures latency simulation
func (*MockSecretsBuilder) WithProvider ¶
func (b *MockSecretsBuilder) WithProvider(name string, provider SecretProvider) *MockSecretsBuilder
WithProvider adds a provider
func (*MockSecretsBuilder) WithSecret ¶
func (b *MockSecretsBuilder) WithSecret(key, value string) *MockSecretsBuilder
WithSecret adds a secret to the mock
func (*MockSecretsBuilder) WithSecrets ¶
func (b *MockSecretsBuilder) WithSecrets(secrets map[string]string) *MockSecretsBuilder
WithSecrets adds multiple secrets
func (*MockSecretsBuilder) WithSetError ¶
func (b *MockSecretsBuilder) WithSetError(err error) *MockSecretsBuilder
WithSetError configures SetSecret error
func (*MockSecretsBuilder) WithStarted ¶
func (b *MockSecretsBuilder) WithStarted(started bool) *MockSecretsBuilder
WithStarted sets the started state
type MockSecretsManager ¶
type MockSecretsManager struct {
// contains filtered or unexported fields
}
MockSecretsManager is a comprehensive mock implementation of SecretsManager optimized for testing with call tracking, assertions, and behavior simulation
func NewMockSecretsManager ¶
func NewMockSecretsManager() *MockSecretsManager
NewMockSecretsManager creates a new mock secrets manager with default settings
func NewMockSecretsManagerWithSecrets ¶
func NewMockSecretsManagerWithSecrets(secrets map[string]string) *MockSecretsManager
NewMockSecretsManagerWithSecrets creates a mock with initial secrets
func (*MockSecretsManager) ClearErrors ¶
func (m *MockSecretsManager) ClearErrors()
ClearErrors clears all configured errors
func (*MockSecretsManager) DeleteCallCount ¶
func (m *MockSecretsManager) DeleteCallCount() int
DeleteCallCount returns the number of DeleteSecret calls
func (*MockSecretsManager) DeleteCalls ¶
func (m *MockSecretsManager) DeleteCalls() []SecretCall
DeleteCalls returns all DeleteSecret calls
func (*MockSecretsManager) DeleteSecret ¶
func (m *MockSecretsManager) DeleteSecret(ctx context.Context, key string) error
DeleteSecret removes a secret
func (*MockSecretsManager) ErrorCount ¶
func (m *MockSecretsManager) ErrorCount() int64
ErrorCount returns the total number of errors
func (*MockSecretsManager) GetCallCount ¶
func (m *MockSecretsManager) GetCallCount() int
GetCallCount returns the number of GetSecret calls
func (*MockSecretsManager) GetCalls ¶
func (m *MockSecretsManager) GetCalls() []SecretCall
GetCalls returns all GetSecret calls
func (*MockSecretsManager) GetProvider ¶
func (m *MockSecretsManager) GetProvider(name string) (SecretProvider, error)
GetProvider returns a secrets provider by name
func (*MockSecretsManager) GetStats ¶
func (m *MockSecretsManager) GetStats() MockStats
GetStats returns usage statistics
func (*MockSecretsManager) HealthCallCount ¶
func (m *MockSecretsManager) HealthCallCount() int
HealthCallCount returns the number of HealthCheck calls
func (*MockSecretsManager) HealthCalls ¶
func (m *MockSecretsManager) HealthCalls() []HealthCall
HealthCalls returns all HealthCheck calls
func (*MockSecretsManager) HealthCheck ¶
func (m *MockSecretsManager) HealthCheck(ctx context.Context) error
HealthCheck performs a health check
func (*MockSecretsManager) IsStarted ¶
func (m *MockSecretsManager) IsStarted() bool
IsStarted returns whether the manager is started
func (*MockSecretsManager) LastAccessed ¶
func (m *MockSecretsManager) LastAccessed() time.Time
LastAccessed returns the timestamp of the last operation
func (*MockSecretsManager) ListCallCount ¶
func (m *MockSecretsManager) ListCallCount() int
ListCallCount returns the number of ListSecrets calls
func (*MockSecretsManager) ListCalls ¶
func (m *MockSecretsManager) ListCalls() []ListCall
ListCalls returns all ListSecrets calls
func (*MockSecretsManager) ListSecrets ¶
func (m *MockSecretsManager) ListSecrets(ctx context.Context) ([]string, error)
ListSecrets returns all secret keys
func (*MockSecretsManager) PrintStats ¶
func (m *MockSecretsManager) PrintStats()
PrintStats prints statistics for debugging
func (*MockSecretsManager) ProviderCount ¶
func (m *MockSecretsManager) ProviderCount() int
ProviderCount returns the number of registered providers
func (*MockSecretsManager) RefreshCallCount ¶
func (m *MockSecretsManager) RefreshCallCount() int
RefreshCallCount returns the number of RefreshSecrets calls
func (*MockSecretsManager) RefreshCalls ¶
func (m *MockSecretsManager) RefreshCalls() []RefreshCall
RefreshCalls returns all RefreshSecrets calls
func (*MockSecretsManager) RefreshSecrets ¶
func (m *MockSecretsManager) RefreshSecrets(ctx context.Context) error
RefreshSecrets refreshes all cached secrets
func (*MockSecretsManager) RegisterProvider ¶
func (m *MockSecretsManager) RegisterProvider(name string, provider SecretProvider) error
RegisterProvider registers a secrets provider
func (*MockSecretsManager) Reset ¶
func (m *MockSecretsManager) Reset()
Reset resets the mock to its initial state
func (*MockSecretsManager) ResetCallTracking ¶
func (m *MockSecretsManager) ResetCallTracking()
ResetCallTracking resets only the call tracking (keeps secrets and state)
func (*MockSecretsManager) RotateCallCount ¶
func (m *MockSecretsManager) RotateCallCount() int
RotateCallCount returns the number of RotateSecret calls
func (*MockSecretsManager) RotateCalls ¶
func (m *MockSecretsManager) RotateCalls() []RotateCall
RotateCalls returns all RotateSecret calls
func (*MockSecretsManager) RotateSecret ¶
func (m *MockSecretsManager) RotateSecret(ctx context.Context, key, newValue string) error
RotateSecret rotates a secret with a new value
func (*MockSecretsManager) SecretCount ¶
func (m *MockSecretsManager) SecretCount() int
SecretCount returns the number of secrets stored
func (*MockSecretsManager) SetCallCount ¶
func (m *MockSecretsManager) SetCallCount() int
SetCallCount returns the number of SetSecret calls
func (*MockSecretsManager) SetCalls ¶
func (m *MockSecretsManager) SetCalls() []SecretCall
SetCalls returns all SetSecret calls
func (*MockSecretsManager) SetDeleteError ¶
func (m *MockSecretsManager) SetDeleteError(err error)
SetDeleteError configures DeleteSecret to return an error
func (*MockSecretsManager) SetGetError ¶
func (m *MockSecretsManager) SetGetError(err error)
SetGetError configures GetSecret to return an error
func (*MockSecretsManager) SetHealthError ¶
func (m *MockSecretsManager) SetHealthError(err error)
SetHealthError configures HealthCheck to return an error
func (*MockSecretsManager) SetLatencySimulation ¶
func (m *MockSecretsManager) SetLatencySimulation(latency time.Duration)
SetLatencySimulation configures artificial latency for all operations
func (*MockSecretsManager) SetListError ¶
func (m *MockSecretsManager) SetListError(err error)
SetListError configures ListSecrets to return an error
func (*MockSecretsManager) SetRefreshError ¶
func (m *MockSecretsManager) SetRefreshError(err error)
SetRefreshError configures RefreshSecrets to return an error
func (*MockSecretsManager) SetRotateError ¶
func (m *MockSecretsManager) SetRotateError(err error)
SetRotateError configures RotateSecret to return an error
func (*MockSecretsManager) SetSecret ¶
func (m *MockSecretsManager) SetSecret(ctx context.Context, key, value string) error
SetSecret stores a secret
func (*MockSecretsManager) SetSetError ¶
func (m *MockSecretsManager) SetSetError(err error)
SetSetError configures SetSecret to return an error
func (*MockSecretsManager) SetStartError ¶
func (m *MockSecretsManager) SetStartError(err error)
SetStartError configures Start to return an error
func (*MockSecretsManager) SetStopError ¶
func (m *MockSecretsManager) SetStopError(err error)
SetStopError configures Stop to return an error
func (*MockSecretsManager) Start ¶
func (m *MockSecretsManager) Start(ctx context.Context) error
Start starts the secrets manager
func (*MockSecretsManager) StartCallCount ¶
func (m *MockSecretsManager) StartCallCount() int
StartCallCount returns the number of Start calls
func (*MockSecretsManager) StartCalls ¶
func (m *MockSecretsManager) StartCalls() []LifecycleCall
StartCalls returns all Start calls
func (*MockSecretsManager) Stop ¶
func (m *MockSecretsManager) Stop(ctx context.Context) error
Stop stops the secrets manager
func (*MockSecretsManager) StopCallCount ¶
func (m *MockSecretsManager) StopCallCount() int
StopCallCount returns the number of Stop calls
func (*MockSecretsManager) StopCalls ¶
func (m *MockSecretsManager) StopCalls() []LifecycleCall
StopCalls returns all Stop calls
func (*MockSecretsManager) TotalCallCount ¶
func (m *MockSecretsManager) TotalCallCount() int64
TotalCallCount returns the total number of calls
func (*MockSecretsManager) WasDeleteCalledWith ¶
func (m *MockSecretsManager) WasDeleteCalledWith(key string) bool
WasDeleteCalledWith checks if DeleteSecret was called with a specific key
func (*MockSecretsManager) WasGetCalledWith ¶
func (m *MockSecretsManager) WasGetCalledWith(key string) bool
WasGetCalledWith checks if GetSecret was called with a specific key
func (*MockSecretsManager) WasRotateCalledWith ¶
func (m *MockSecretsManager) WasRotateCalledWith(key string) bool
WasRotateCalledWith checks if RotateSecret was called with a specific key
func (*MockSecretsManager) WasSetCalledWith ¶
func (m *MockSecretsManager) WasSetCalledWith(key, value string) bool
WasSetCalledWith checks if SetSecret was called with a specific key and value
type MockStats ¶
type MockStats struct {
SecretCount int
ProviderCount int
TotalCalls int64
ErrorCount int64
Started bool
LastAccessed time.Time
GetCalls int
SetCalls int
DeleteCalls int
ListCalls int
RotateCalls int
RefreshCalls int
StartCalls int
StopCalls int
HealthCalls int
}
Stats contains statistics about the mock's usage
type PropertySchema ¶
type PropertySchema struct {
Type PropertyType `json:"type"`
Required bool `json:"required"`
Default interface{} `json:"default,omitempty"`
Description string `json:"description,omitempty"`
Format string `json:"format,omitempty"`
Pattern string `json:"pattern,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
Minimum *float64 `json:"minimum,omitempty"`
Maximum *float64 `json:"maximum,omitempty"`
MinLength *int `json:"min_length,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
Items *PropertySchema `json:"items,omitempty"`
Properties map[string]PropertySchema `json:"properties,omitempty"`
Constraints []ConstraintRule `json:"constraints,omitempty"`
}
PropertySchema defines validation for a specific property
type PropertyType ¶
type PropertyType string
PropertyType represents the type of a configuration property
const ( PropertyTypeString PropertyType = "string" PropertyTypeInteger PropertyType = "integer" PropertyTypeNumber PropertyType = "number" PropertyTypeBoolean PropertyType = "boolean" PropertyTypeArray PropertyType = "array" PropertyTypeObject PropertyType = "object" PropertyTypeAny PropertyType = "any" )
type ProviderConfig ¶
type ProviderConfig struct {
Type string `yaml:"type" json:"type"`
Priority int `yaml:"priority" json:"priority"`
Properties map[string]interface{} `yaml:"properties" json:"properties"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
ProviderConfig contains configuration for a secret provider
type RefreshCall ¶
RefreshCall represents a tracked refresh operation
type RotateCall ¶
type RotateCall struct {
Key string
OldValue string
NewValue string
Timestamp time.Time
Error error
}
RotateCall represents a tracked rotate operation
type SecretCall ¶
SecretCall represents a tracked secret operation call
type SecretEncryptor ¶
type SecretEncryptor struct {
// contains filtered or unexported fields
}
SecretEncryptor handles encryption and decryption of secrets
func NewSecretEncryptor ¶
func NewSecretEncryptor(keyStr string) *SecretEncryptor
NewSecretEncryptor creates a new secret encryptor
type SecretGenerator ¶
type SecretGenerator interface {
GenerateSecret(ctx context.Context, key string, metadata SecretMetadata) (string, error)
ValidateSecret(ctx context.Context, value string) error
}
SecretGenerator generates new secret values
type SecretMetadata ¶
type SecretMetadata struct {
Key string `json:"key"`
Provider string `json:"provider"`
Created time.Time `json:"created"`
LastAccessed time.Time `json:"last_accessed"`
LastRotated time.Time `json:"last_rotated,omitempty"`
AccessCount int64 `json:"access_count"`
Tags map[string]string `json:"tags,omitempty"`
Encrypted bool `json:"encrypted"`
TTL time.Duration `json:"ttl,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
}
SecretMetadata contains metadata about a secret
type SecretProvider ¶
type SecretProvider = configscore.SecretProvider
SecretProvider defines an interface for different secret backends
type SecretRotationPolicy ¶
type SecretRotationPolicy struct {
Enabled bool `json:"enabled"`
Interval time.Duration `json:"interval"`
MaxAge time.Duration `json:"max_age"`
Generator SecretGenerator `json:"-"`
Validators []SecretValidator `json:"-"`
NotifyOn []string `json:"notify_on"`
}
SecretRotationPolicy defines how secrets should be rotated
type SecretValidator ¶
type SecretValidator interface {
ValidateSecret(ctx context.Context, key, value string) error
GetValidationRules() []string
}
SecretValidator validates secret values
type SecretsConfig ¶
type SecretsConfig struct {
DefaultProvider string `yaml:"default_provider" json:"default_provider"`
Providers map[string]ProviderConfig `yaml:"providers" json:"providers"`
CacheEnabled bool `yaml:"cache_enabled" json:"cache_enabled"`
CacheTTL time.Duration `yaml:"cache_ttl" json:"cache_ttl"`
RotationEnabled bool `yaml:"rotation_enabled" json:"rotation_enabled"`
RotationInterval time.Duration `yaml:"rotation_interval" json:"rotation_interval"`
EncryptionEnabled bool `yaml:"encryption_enabled" json:"encryption_enabled"`
EncryptionKey string `yaml:"encryption_key" json:"encryption_key"`
MetricsEnabled bool `yaml:"metrics_enabled" json:"metrics_enabled"`
Logger logger.Logger `yaml:"-" json:"-"`
Metrics shared.Metrics `yaml:"-" json:"-"`
ErrorHandler shared.ErrorHandler `yaml:"-" json:"-"`
}
SecretsConfig contains configuration for the secrets manager
type SecretsManager ¶
type SecretsManager = configscore.SecretsManager
SecretsManager manages secrets for configuration
func NewSecretsManager ¶
func NewSecretsManager(config SecretsConfig) SecretsManager
NewSecretsManager creates a new secrets manager
type SecretsManagerImpl ¶
type SecretsManagerImpl struct {
// contains filtered or unexported fields
}
SecretsManagerImpl implements the SecretsManager interface
func (*SecretsManagerImpl) DeleteSecret ¶
func (sm *SecretsManagerImpl) DeleteSecret(ctx context.Context, key string) error
DeleteSecret removes a secret
func (*SecretsManagerImpl) GetProvider ¶
func (sm *SecretsManagerImpl) GetProvider(name string) (SecretProvider, error)
GetProvider returns a secrets provider by name
func (*SecretsManagerImpl) HealthCheck ¶
func (sm *SecretsManagerImpl) HealthCheck(ctx context.Context) error
HealthCheck performs a health check
func (*SecretsManagerImpl) ListSecrets ¶
func (sm *SecretsManagerImpl) ListSecrets(ctx context.Context) ([]string, error)
ListSecrets returns all secret keys
func (*SecretsManagerImpl) RefreshSecrets ¶
func (sm *SecretsManagerImpl) RefreshSecrets(ctx context.Context) error
RefreshSecrets refreshes all cached secrets
func (*SecretsManagerImpl) RegisterProvider ¶
func (sm *SecretsManagerImpl) RegisterProvider(name string, provider SecretProvider) error
RegisterProvider registers a secrets provider
func (*SecretsManagerImpl) RotateSecret ¶
func (sm *SecretsManagerImpl) RotateSecret(ctx context.Context, key, newValue string) error
RotateSecret rotates a secret with a new value
func (*SecretsManagerImpl) SetSecret ¶
func (sm *SecretsManagerImpl) SetSecret(ctx context.Context, key, value string) error
SetSecret stores a secret
type SourceConfig ¶
type SourceConfig = core.SourceConfig
SourceConfig contains common configuration for all sources
type SourceEvent ¶
type SourceEvent = core.SourceEvent
SourceEvent represents an event from a configuration source
type SourceEventHandler ¶
type SourceEventHandler = core.SourceEventHandler
SourceEventHandler handles events from configuration sources
type SourceMetadata ¶
type SourceMetadata = core.SourceMetadata
SourceMetadata contains metadata about a configuration source
type SourceRegistry ¶
type SourceRegistry = core.SourceRegistry
SourceRegistry manages registered configuration sources
func NewSourceRegistry ¶
func NewSourceRegistry(logger logger.Logger) SourceRegistry
NewSourceRegistry creates a new source registry
type SourceRegistryImpl ¶
type SourceRegistryImpl struct {
// contains filtered or unexported fields
}
SourceRegistryImpl implements the SourceRegistry interface
func (*SourceRegistryImpl) Clear ¶
func (sr *SourceRegistryImpl) Clear() error
Clear removes all registered sources
func (*SourceRegistryImpl) GetAllMetadata ¶
func (sr *SourceRegistryImpl) GetAllMetadata() map[string]*SourceMetadata
GetAllMetadata returns metadata for all sources
func (*SourceRegistryImpl) GetSource ¶
func (sr *SourceRegistryImpl) GetSource(name string) (ConfigSource, error)
GetSource retrieves a configuration source by name
func (*SourceRegistryImpl) GetSourceMetadata ¶
func (sr *SourceRegistryImpl) GetSourceMetadata(name string) (*SourceMetadata, error)
GetSourceMetadata returns metadata for a source
func (*SourceRegistryImpl) GetSourceNames ¶
func (sr *SourceRegistryImpl) GetSourceNames() []string
GetSourceNames returns the names of all registered sources
func (*SourceRegistryImpl) GetSourceStats ¶
func (sr *SourceRegistryImpl) GetSourceStats() map[string]interface{}
GetSourceStats returns statistics about the registry
func (*SourceRegistryImpl) GetSources ¶
func (sr *SourceRegistryImpl) GetSources() []ConfigSource
GetSources returns all registered sources ordered by priority
func (*SourceRegistryImpl) GetSourcesByType ¶
func (sr *SourceRegistryImpl) GetSourcesByType(sourceType string) []ConfigSource
GetSourcesByType returns sources of a specific type
func (*SourceRegistryImpl) GetSourcesWithSecrets ¶
func (sr *SourceRegistryImpl) GetSourcesWithSecrets() []ConfigSource
GetSourcesWithSecrets returns all sources that support secrets
func (*SourceRegistryImpl) GetWatchableSources ¶
func (sr *SourceRegistryImpl) GetWatchableSources() []ConfigSource
GetWatchableSources returns all sources that support watching
func (*SourceRegistryImpl) HasSource ¶
func (sr *SourceRegistryImpl) HasSource(name string) bool
HasSource returns true if a source with the given name is registered
func (*SourceRegistryImpl) IsEmpty ¶
func (sr *SourceRegistryImpl) IsEmpty() bool
IsEmpty returns true if no sources are registered
func (*SourceRegistryImpl) RegisterSource ¶
func (sr *SourceRegistryImpl) RegisterSource(source ConfigSource) error
RegisterSource registers a configuration source
func (*SourceRegistryImpl) UnregisterSource ¶
func (sr *SourceRegistryImpl) UnregisterSource(name string) error
UnregisterSource unregisters a configuration source
func (*SourceRegistryImpl) UpdateLoadStats ¶
func (sr *SourceRegistryImpl) UpdateLoadStats(name string, keyCount int, err error) error
UpdateLoadStats updates load statistics for a source
func (*SourceRegistryImpl) UpdateModifiedTime ¶
func (sr *SourceRegistryImpl) UpdateModifiedTime(name string, modifiedTime time.Time) error
UpdateModifiedTime updates the last modified time for a source
func (*SourceRegistryImpl) UpdateSourceMetadata ¶
func (sr *SourceRegistryImpl) UpdateSourceMetadata(name string, updater func(*SourceMetadata)) error
UpdateSourceMetadata updates metadata for a source (internal use)
func (*SourceRegistryImpl) UpdateWatchStatus ¶
func (sr *SourceRegistryImpl) UpdateWatchStatus(name string, isWatching bool) error
UpdateWatchStatus updates watch status for a source
func (*SourceRegistryImpl) ValidateSourceDependencies ¶
func (sr *SourceRegistryImpl) ValidateSourceDependencies() error
ValidateSourceDependencies validates that all source dependencies are met
type TestConfigAssertions ¶
type TestConfigAssertions struct {
// contains filtered or unexported fields
}
TestConfigAssertions provides assertion helpers for testing configuration
func NewTestConfigAssertions ¶
func NewTestConfigAssertions(manager ConfigManager) *TestConfigAssertions
NewTestConfigAssertions creates assertion helpers for the test config manager
func (*TestConfigAssertions) AssertIntEquals ¶
func (a *TestConfigAssertions) AssertIntEquals(key string, expected int) bool
AssertIntEquals checks that a key has the expected int value
func (*TestConfigAssertions) AssertKeyEquals ¶
func (a *TestConfigAssertions) AssertKeyEquals(key string, expected interface{}) bool
AssertKeyEquals checks that a key has the expected value
func (*TestConfigAssertions) AssertKeyExists ¶
func (a *TestConfigAssertions) AssertKeyExists(key string) bool
AssertKeyExists checks that a key exists
func (*TestConfigAssertions) AssertStringEquals ¶
func (a *TestConfigAssertions) AssertStringEquals(key string, expected string) bool
AssertStringEquals checks that a key has the expected string value
type TestConfigBuilder ¶
type TestConfigBuilder struct {
// contains filtered or unexported fields
}
TestConfigBuilder provides a fluent interface for building test configurations
func NewTestConfigBuilder ¶
func NewTestConfigBuilder() *TestConfigBuilder
NewTestConfigBuilder creates a new builder for test configurations
func (*TestConfigBuilder) Build ¶
func (b *TestConfigBuilder) Build() ConfigManager
Build creates a TestConfigManager with the configured data
func (*TestConfigBuilder) Set ¶
func (b *TestConfigBuilder) Set(key string, value interface{}) *TestConfigBuilder
Set sets a key-value pair
func (*TestConfigBuilder) SetDefaults ¶
func (b *TestConfigBuilder) SetDefaults(defaults map[string]interface{}) *TestConfigBuilder
SetDefaults sets multiple default values
func (*TestConfigBuilder) SetSection ¶
func (b *TestConfigBuilder) SetSection(key string, section map[string]interface{}) *TestConfigBuilder
SetSection sets a configuration section
type TestConfigManager ¶
type TestConfigManager struct {
// contains filtered or unexported fields
}
TestConfigManager is a lightweight, in-memory implementation of ConfigManager optimized for testing scenarios. It provides realistic behavior without external dependencies like files, databases, or network services.
func (*TestConfigManager) AllKeys ¶
func (t *TestConfigManager) AllKeys() []string
AllKeys is an alias for GetKeys
func (*TestConfigManager) AllSettings ¶
func (t *TestConfigManager) AllSettings() map[string]interface{}
AllSettings is an alias for GetAllSettings
func (*TestConfigManager) Bind ¶
func (t *TestConfigManager) Bind(key string, target interface{}) error
Bind binds configuration to a struct (simplified for testing)
func (*TestConfigManager) BindWithDefault ¶
func (t *TestConfigManager) BindWithDefault(key string, target interface{}, defaultValue interface{}) error
BindWithDefault binds with a default value
func (*TestConfigManager) BindWithOptions ¶
func (t *TestConfigManager) BindWithOptions(key string, target interface{}, options configcore.BindOptions) error
BindWithOptions binds with flexible options
func (*TestConfigManager) Clone ¶
func (t *TestConfigManager) Clone() ConfigManager
Clone creates a deep copy
func (*TestConfigManager) ConfigFileUsed ¶
func (t *TestConfigManager) ConfigFileUsed() string
ConfigFileUsed returns the config file path
func (*TestConfigManager) ExpandEnvVars ¶
func (t *TestConfigManager) ExpandEnvVars() error
ExpandEnvVars expands environment variables (no-op for testing)
func (*TestConfigManager) Get ¶
func (t *TestConfigManager) Get(key string) interface{}
Get returns a configuration value
func (*TestConfigManager) GetAllSettings ¶
func (t *TestConfigManager) GetAllSettings() map[string]interface{}
GetAllSettings returns all settings
func (*TestConfigManager) GetBool ¶
func (t *TestConfigManager) GetBool(key string, defaultValue ...bool) bool
GetBool returns a bool value with optional default
func (*TestConfigManager) GetBoolSlice ¶
func (t *TestConfigManager) GetBoolSlice(key string, defaultValue ...[]bool) []bool
GetBoolSlice returns a bool slice with optional default
func (*TestConfigManager) GetBoolWithOptions ¶
func (t *TestConfigManager) GetBoolWithOptions(key string, opts ...configcore.GetOption) (bool, error)
GetBoolWithOptions returns a bool with advanced options
func (*TestConfigManager) GetBytesSize ¶
func (t *TestConfigManager) GetBytesSize(key string, defaultValue ...uint64) uint64
GetBytesSize is an alias for GetSizeInBytes
func (*TestConfigManager) GetDuration ¶
GetDuration returns a duration value with optional default
func (*TestConfigManager) GetDurationWithOptions ¶
func (t *TestConfigManager) GetDurationWithOptions(key string, opts ...configcore.GetOption) (time.Duration, error)
GetDurationWithOptions returns a duration with advanced options
func (*TestConfigManager) GetFloat32 ¶
func (t *TestConfigManager) GetFloat32(key string, defaultValue ...float32) float32
GetFloat32 returns a float32 value with optional default
func (*TestConfigManager) GetFloat64 ¶
func (t *TestConfigManager) GetFloat64(key string, defaultValue ...float64) float64
GetFloat64 returns a float64 value with optional default
func (*TestConfigManager) GetFloat64Slice ¶
func (t *TestConfigManager) GetFloat64Slice(key string, defaultValue ...[]float64) []float64
GetFloat64Slice returns a float64 slice with optional default
func (*TestConfigManager) GetInt ¶
func (t *TestConfigManager) GetInt(key string, defaultValue ...int) int
GetInt returns an int value with optional default
func (*TestConfigManager) GetInt16 ¶
func (t *TestConfigManager) GetInt16(key string, defaultValue ...int16) int16
GetInt16 returns an int16 value with optional default
func (*TestConfigManager) GetInt32 ¶
func (t *TestConfigManager) GetInt32(key string, defaultValue ...int32) int32
GetInt32 returns an int32 value with optional default
func (*TestConfigManager) GetInt64 ¶
func (t *TestConfigManager) GetInt64(key string, defaultValue ...int64) int64
GetInt64 returns an int64 value with optional default
func (*TestConfigManager) GetInt64Slice ¶
func (t *TestConfigManager) GetInt64Slice(key string, defaultValue ...[]int64) []int64
GetInt64Slice returns an int64 slice with optional default
func (*TestConfigManager) GetInt8 ¶
func (t *TestConfigManager) GetInt8(key string, defaultValue ...int8) int8
GetInt8 returns an int8 value with optional default
func (*TestConfigManager) GetIntSlice ¶
func (t *TestConfigManager) GetIntSlice(key string, defaultValue ...[]int) []int
GetIntSlice returns an int slice with optional default
func (*TestConfigManager) GetIntWithOptions ¶
func (t *TestConfigManager) GetIntWithOptions(key string, opts ...configcore.GetOption) (int, error)
GetIntWithOptions returns an int with advanced options
func (*TestConfigManager) GetKeys ¶
func (t *TestConfigManager) GetKeys() []string
GetKeys returns all configuration keys
func (*TestConfigManager) GetSection ¶
func (t *TestConfigManager) GetSection(key string) map[string]interface{}
GetSection returns a configuration section
func (*TestConfigManager) GetSizeInBytes ¶
func (t *TestConfigManager) GetSizeInBytes(key string, defaultValue ...uint64) uint64
GetSizeInBytes returns size in bytes with optional default
func (*TestConfigManager) GetSourceMetadata ¶
func (t *TestConfigManager) GetSourceMetadata() map[string]*SourceMetadata
GetSourceMetadata returns metadata for all sources
func (*TestConfigManager) GetString ¶
func (t *TestConfigManager) GetString(key string, defaultValue ...string) string
GetString returns a string value with optional default
func (*TestConfigManager) GetStringMap ¶
func (t *TestConfigManager) GetStringMap(key string, defaultValue ...map[string]string) map[string]string
GetStringMap returns a string map with optional default
func (*TestConfigManager) GetStringMapString ¶
func (t *TestConfigManager) GetStringMapString(key string, defaultValue ...map[string]string) map[string]string
GetStringMapString is an alias for GetStringMap
func (*TestConfigManager) GetStringMapStringSlice ¶
func (t *TestConfigManager) GetStringMapStringSlice(key string, defaultValue ...map[string][]string) map[string][]string
GetStringMapStringSlice returns a map of string slices with optional default
func (*TestConfigManager) GetStringSlice ¶
func (t *TestConfigManager) GetStringSlice(key string, defaultValue ...[]string) []string
GetStringSlice returns a string slice with optional default
func (*TestConfigManager) GetStringWithOptions ¶
func (t *TestConfigManager) GetStringWithOptions(key string, opts ...configcore.GetOption) (string, error)
GetStringWithOptions returns a string with advanced options
func (*TestConfigManager) GetUint ¶
func (t *TestConfigManager) GetUint(key string, defaultValue ...uint) uint
GetUint returns a uint value with optional default
func (*TestConfigManager) GetUint16 ¶
func (t *TestConfigManager) GetUint16(key string, defaultValue ...uint16) uint16
GetUint16 returns a uint16 value with optional default
func (*TestConfigManager) GetUint32 ¶
func (t *TestConfigManager) GetUint32(key string, defaultValue ...uint32) uint32
GetUint32 returns a uint32 value with optional default
func (*TestConfigManager) GetUint64 ¶
func (t *TestConfigManager) GetUint64(key string, defaultValue ...uint64) uint64
GetUint64 returns a uint64 value with optional default
func (*TestConfigManager) GetUint8 ¶
func (t *TestConfigManager) GetUint8(key string, defaultValue ...uint8) uint8
GetUint8 returns a uint8 value with optional default
func (*TestConfigManager) GetWithOptions ¶
func (t *TestConfigManager) GetWithOptions(key string, opts ...configcore.GetOption) (interface{}, error)
GetWithOptions returns a value with advanced options
func (*TestConfigManager) HasKey ¶
func (t *TestConfigManager) HasKey(key string) bool
HasKey checks if a key exists
func (*TestConfigManager) InConfig ¶
func (t *TestConfigManager) InConfig(key string) bool
InConfig is an alias for HasKey
func (*TestConfigManager) IsSet ¶
func (t *TestConfigManager) IsSet(key string) bool
IsSet checks if a key is set and not empty
func (*TestConfigManager) LoadFrom ¶
func (t *TestConfigManager) LoadFrom(sources ...ConfigSource) error
LoadFrom simulates loading from sources
func (*TestConfigManager) MergeWith ¶
func (t *TestConfigManager) MergeWith(other ConfigManager) error
MergeWith merges another config manager
func (*TestConfigManager) Name ¶
func (t *TestConfigManager) Name() string
Name returns the manager name
func (*TestConfigManager) OnConfigChange ¶
func (t *TestConfigManager) OnConfigChange(callback func(ConfigChange))
OnConfigChange is an alias for WatchChanges
func (*TestConfigManager) ReadInConfig ¶
func (t *TestConfigManager) ReadInConfig() error
ReadInConfig reads configuration
func (*TestConfigManager) Reload ¶
func (t *TestConfigManager) Reload() error
Reload simulates reloading configuration
func (*TestConfigManager) ReloadContext ¶
func (t *TestConfigManager) ReloadContext(ctx context.Context) error
ReloadContext simulates reload with context
func (*TestConfigManager) Reset ¶
func (t *TestConfigManager) Reset()
Reset clears all configuration
func (*TestConfigManager) SafeGet ¶
func (t *TestConfigManager) SafeGet(key string, expectedType reflect.Type) (interface{}, error)
SafeGet returns a value with type checking
func (*TestConfigManager) SecretsManager ¶
func (t *TestConfigManager) SecretsManager() SecretsManager
SecretsManager returns the secrets manager
func (*TestConfigManager) Set ¶
func (t *TestConfigManager) Set(key string, value interface{})
Set sets a configuration value
func (*TestConfigManager) SetConfigFile ¶
func (t *TestConfigManager) SetConfigFile(filePath string) error
SetConfigFile sets the configuration file (no-op for testing)
func (*TestConfigManager) SetConfigType ¶
func (t *TestConfigManager) SetConfigType(configType string)
SetConfigType sets the configuration type (no-op for testing)
func (*TestConfigManager) SimulateConfigChange ¶
func (t *TestConfigManager) SimulateConfigChange(key string, newValue interface{})
SimulateConfigChange simulates a configuration change for testing watchers
func (*TestConfigManager) Size ¶
func (t *TestConfigManager) Size() int
Size returns the number of keys
func (*TestConfigManager) Sub ¶
func (t *TestConfigManager) Sub(key string) ConfigManager
Sub returns a sub-configuration manager
func (*TestConfigManager) Unmarshal ¶
func (t *TestConfigManager) Unmarshal(rawVal interface{}) error
Unmarshal unmarshals entire configuration
func (*TestConfigManager) UnmarshalKey ¶
func (t *TestConfigManager) UnmarshalKey(key string, rawVal interface{}) error
UnmarshalKey is an alias for Bind
func (*TestConfigManager) Validate ¶
func (t *TestConfigManager) Validate() error
Validate always validates successfully in tests
func (*TestConfigManager) Watch ¶
func (t *TestConfigManager) Watch(ctx context.Context) error
Watch simulates watching for changes
func (*TestConfigManager) WatchChanges ¶
func (t *TestConfigManager) WatchChanges(callback func(ConfigChange))
WatchChanges registers a callback for all changes
func (*TestConfigManager) WatchConfig ¶
func (t *TestConfigManager) WatchConfig() error
WatchConfig is an alias for Watch
func (*TestConfigManager) WatchWithCallback ¶
func (t *TestConfigManager) WatchWithCallback(key string, callback func(string, interface{}))
WatchWithCallback registers a callback for key changes
type ValidationConfig ¶
type ValidationConfig = core.ValidationConfig
ValidationConfig contains validation configuration for sources
type ValidationError ¶
type ValidationError = errors.ValidationError
Re-export error types from internal/errors
type ValidationMode ¶
type ValidationMode string
ValidationMode defines the validation mode
const ( ValidationModeStrict ValidationMode = "strict" ValidationModeLoose ValidationMode = "loose" ValidationModePermissive ValidationMode = "permissive" ValidationModeDisabled ValidationMode = "disabled" )
type ValidationOptions ¶
type ValidationOptions = core.ValidationOptions
ValidationOptions contains validation configuration
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Errors []ValidationError `json:"errors,omitempty"`
Warnings []ValidationWarning `json:"warnings,omitempty"`
Schema string `json:"schema,omitempty"`
}
ValidationResult contains the result of validation
type ValidationRule ¶
type ValidationRule = core.ValidationRule
ValidationRule represents a custom validation rule
type ValidationSchema ¶
type ValidationSchema struct {
Name string `json:"name"`
Path string `json:"path"`
Required []string `json:"required"`
Properties map[string]PropertySchema `json:"properties"`
Constraints []ConstraintRule `json:"constraints"`
Custom []ValidationRule `json:"-"`
}
ValidationSchema defines a schema for validating configuration sections
type ValidationWarning ¶
type ValidationWarning struct {
Key string `json:"key"`
Value interface{} `json:"value,omitempty"`
Message string `json:"message"`
Suggestion string `json:"suggestion,omitempty"`
}
ValidationWarning represents a validation warning
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator handles configuration validation
func NewValidator ¶
func NewValidator(config ValidatorConfig) *Validator
NewValidator creates a new configuration validator
func (*Validator) AddConstraint ¶
func (v *Validator) AddConstraint(keyPattern string, constraint ConstraintRule)
AddConstraint adds a constraint rule for a specific key pattern
func (*Validator) AddRule ¶
func (v *Validator) AddRule(keyPattern string, rule ValidationRule)
AddRule adds a validation rule for a specific key pattern
func (*Validator) IsStrictMode ¶
IsStrictMode returns true if the validator is in strict mode
func (*Validator) RegisterSchema ¶
func (v *Validator) RegisterSchema(schema ValidationSchema)
RegisterSchema registers a validation schema
func (*Validator) SetMode ¶
func (v *Validator) SetMode(mode ValidationMode)
SetMode sets the validation mode
func (*Validator) ValidateAll ¶
ValidateAll validates the entire configuration
func (*Validator) ValidateConfig ¶
func (v *Validator) ValidateConfig(config map[string]interface{}) ValidationResult
ValidateConfig validates a configuration map
type ValidatorConfig ¶
type ValidatorConfig struct {
Mode ValidationMode
DefaultRules []ValidationRule
DefaultSchemas []ValidationSchema
Logger logger.Logger
ErrorHandler shared.ErrorHandler
StrictMode bool
ValidateOnLoad bool
ValidateOnSet bool
}
ValidatorConfig contains configuration for the validator
type VaultSecretProvider ¶
type VaultSecretProvider struct {
// contains filtered or unexported fields
}
VaultSecretProvider provides secrets from HashiCorp Vault (placeholder)
func (*VaultSecretProvider) Close ¶
func (vsp *VaultSecretProvider) Close(ctx context.Context) error
func (*VaultSecretProvider) DeleteSecret ¶
func (vsp *VaultSecretProvider) DeleteSecret(ctx context.Context, key string) error
func (*VaultSecretProvider) HealthCheck ¶
func (vsp *VaultSecretProvider) HealthCheck(ctx context.Context) error
func (*VaultSecretProvider) Initialize ¶
func (vsp *VaultSecretProvider) Initialize(ctx context.Context, config map[string]interface{}) error
func (*VaultSecretProvider) ListSecrets ¶
func (vsp *VaultSecretProvider) ListSecrets(ctx context.Context) ([]string, error)
func (*VaultSecretProvider) Name ¶
func (vsp *VaultSecretProvider) Name() string
func (*VaultSecretProvider) SetSecret ¶
func (vsp *VaultSecretProvider) SetSecret(ctx context.Context, key, value string) error
func (*VaultSecretProvider) SupportsCaching ¶
func (vsp *VaultSecretProvider) SupportsCaching() bool
func (*VaultSecretProvider) SupportsRotation ¶
func (vsp *VaultSecretProvider) SupportsRotation() bool
type WatchCallback ¶
WatchCallback represents a callback function for configuration changes
type WatchContext ¶
type WatchContext = core.WatchContext
WatchContext contains context for watching configuration changes
type WatchEvent ¶
type WatchEvent struct {
SourceName string `json:"source_name"`
EventType WatchEventType `json:"event_type"`
Data map[string]interface{} `json:"data"`
Timestamp time.Time `json:"timestamp"`
Checksum string `json:"checksum,omitempty"`
Error error `json:"error,omitempty"`
}
WatchEvent represents a configuration change event
type WatchEventType ¶
type WatchEventType string
WatchEventType represents the type of watch event
const ( WatchEventTypeChange WatchEventType = "change" WatchEventTypeCreate WatchEventType = "create" WatchEventTypeDelete WatchEventType = "delete" WatchEventTypeError WatchEventType = "error" WatchEventTypeReload WatchEventType = "reload" )
type WatchStats ¶
type WatchStats struct {
SourceName string `json:"source_name"`
Active bool `json:"active"`
LastCheck time.Time `json:"last_check"`
ChangeCount int64 `json:"change_count"`
ErrorCount int64 `json:"error_count"`
Interval time.Duration `json:"interval"`
Uptime time.Duration `json:"uptime"`
}
WatchStats contains statistics about a watched source
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher handles watching configuration sources for changes
func NewWatcher ¶
func NewWatcher(config WatcherConfig) *Watcher
NewWatcher creates a new configuration watcher
func (*Watcher) GetAllStats ¶
func (w *Watcher) GetAllStats() map[string]*WatchStats
GetAllStats returns statistics for all watched sources
func (*Watcher) GetSourceStats ¶
func (w *Watcher) GetSourceStats(sourceName string) (*WatchStats, error)
GetSourceStats returns statistics for a watched source
func (*Watcher) GetWatchedSources ¶
GetWatchedSources returns the list of currently watched sources
func (*Watcher) RegisterEventHandler ¶
func (w *Watcher) RegisterEventHandler(sourceName string, handler SourceEventHandler)
RegisterEventHandler registers an event handler for a source
func (*Watcher) StopWatching ¶
StopWatching stops watching a specific source
func (*Watcher) UnregisterEventHandler ¶
func (w *Watcher) UnregisterEventHandler(sourceName string, handler SourceEventHandler)
UnregisterEventHandler unregisters an event handler for a source
func (*Watcher) WatchSource ¶
func (w *Watcher) WatchSource(ctx context.Context, source ConfigSource, callback WatchCallback) error
WatchSource starts watching a configuration source
type WatcherConfig ¶
type WatcherConfig struct {
Interval time.Duration
BufferSize int
MaxRetries int
RetryInterval time.Duration
Logger logger.Logger
Metrics shared.Metrics
ErrorHandler shared.ErrorHandler
EnableDebounce bool
DebounceTime time.Duration
}
WatcherConfig contains configuration for the watcher