Documentation
¶
Index ¶
- type Client
- func (c *Client) AddEncryptionProvider(provider EncryptionProvider)
- func (c *Client) AddSource(source Source) error
- func (c *Client) AddSources(sources []Source) error
- func (c *Client) Close() error
- func (c *Client) CreateProvider(sourceURI string) (providers.Provider, error)
- func (c *Client) DecryptValue(ctx context.Context, encryptedValue string) (string, error)
- func (c *Client) EncryptValue(ctx context.Context, value string, providerType string, keyID string) (string, error)
- func (c *Client) Exists(ctx context.Context, configPath string) bool
- func (c *Client) GenerateSecretKey(length int) ([]byte, error)
- func (c *Client) Get(ctx context.Context, configPath string) ([]byte, error)
- func (c *Client) GetMultiple(ctx context.Context, configPaths []string) (map[string][]byte, error)
- func (c *Client) GetSecurely(ctx context.Context, configPath string) ([]byte, error)
- func (c *Client) GetValue(ctx context.Context, valuePath string) (interface{}, error)
- func (c *Client) LoadProviders(ctx context.Context, configPath string) error
- func (c *Client) MergeConfigs(ctx context.Context, paths []string, options MergeOptions) (interface{}, error)
- func (c *Client) NewEnvProvider(prefix string, delimiter string)
- func (c *Client) NewFileProvider(name, directory string) (providers.Provider, error)
- func (c *Client) NewKMSEncryptionProvider(keyID string, region string) error
- func (c *Client) NewLocalEncryptionProvider(keyID string, key []byte) error
- func (c *Client) Refresh(ctx context.Context, configPath string) error
- func (c *Client) RefreshAll(ctx context.Context)
- func (c *Client) RegisterDefaultProviders()
- func (c *Client) RegisterProvider(name string, provider providers.Provider)
- func (c *Client) RegisterProviderFactory(providerType string, factory providers.ProviderFactory)
- func (c *Client) RenderTemplate(ctx context.Context, templatePath string, options TemplateOptions) ([]byte, error)
- func (c *Client) Unmarshal(ctx context.Context, configPath string, target interface{}) error
- func (c *Client) ValidateConfig(ctx context.Context, configPath, schemaPath string) (bool, []string, error)
- func (c *Client) WaitForExists(ctx context.Context, configPath string, timeout time.Duration) error
- func (c *Client) Watch(ctx context.Context, configPath string) (<-chan struct{}, error)
- func (c *Client) WatchAndUnmarshal(ctx context.Context, configPath string, target interface{}, onChange func()) error
- type Config
- type EncryptionProvider
- type EnvConfig
- type MergeOptions
- type Option
- func WithCacheCleanup(duration time.Duration) Option
- func WithCacheEnabled(enabled bool) Option
- func WithCacheExpiration(duration time.Duration) Option
- func WithCacheSize(size int) Option
- func WithDefaultProvider(providerName string) Option
- func WithFIPSMode(enabled bool) Option
- func WithRefreshInterval(interval time.Duration) Option
- func WithTLSConfig(tlsConfig *tls.Config) Option
- type Source
- type TemplateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main ConfiFlow client
func ConfigFromFile ¶
ConfigFromFile initializes a client from a configuration file
func (*Client) AddEncryptionProvider ¶
func (c *Client) AddEncryptionProvider(provider EncryptionProvider)
AddEncryptionProvider adds an encryption provider to the client
func (*Client) AddSources ¶
AddSources adds multiple configuration sources
func (*Client) CreateProvider ¶
CreateProvider creates a provider instance from a source string Format: provider://location?param1=value1¶m2=value2
func (*Client) DecryptValue ¶
DecryptValue decrypts an encrypted value
func (*Client) EncryptValue ¶
func (c *Client) EncryptValue(ctx context.Context, value string, providerType string, keyID string) (string, error)
EncryptValue encrypts a value using the specified provider and key ID
func (*Client) GenerateSecretKey ¶
GenerateSecretKey generates a new random secret key
func (*Client) GetMultiple ¶
GetMultiple retrieves multiple configurations in parallel
func (*Client) GetSecurely ¶
GetSecurely retrieves a configuration value and automatically decrypts any encrypted values
func (*Client) LoadProviders ¶
LoadProviders loads a list of providers defined in a configuration file
func (*Client) MergeConfigs ¶
func (c *Client) MergeConfigs(ctx context.Context, paths []string, options MergeOptions) (interface{}, error)
MergeConfigs merges multiple configuration files into a single structure
func (*Client) NewEnvProvider ¶
NewEnvProvider creates a provider that loads configurations from environment variables
func (*Client) NewFileProvider ¶
func (*Client) NewKMSEncryptionProvider ¶
NewKMSEncryptionProvider creates a new AWS KMS encryption provider
func (*Client) NewLocalEncryptionProvider ¶
NewLocalEncryptionProvider creates a new local encryption provider
func (*Client) RefreshAll ¶
RefreshAll forces a refresh of all cached configurations
func (*Client) RegisterDefaultProviders ¶
func (c *Client) RegisterDefaultProviders()
RegisterDefaultProviders registers all default provider factories
func (*Client) RegisterProvider ¶
RegisterProvider registers a configuration provider
func (*Client) RegisterProviderFactory ¶
func (c *Client) RegisterProviderFactory(providerType string, factory providers.ProviderFactory)
RegisterProviderFactory registers a factory function for creating providers
func (*Client) RenderTemplate ¶
func (c *Client) RenderTemplate(ctx context.Context, templatePath string, options TemplateOptions) ([]byte, error)
RenderTemplate renders a configuration template
func (*Client) ValidateConfig ¶
func (c *Client) ValidateConfig(ctx context.Context, configPath, schemaPath string) (bool, []string, error)
ValidateConfig validates a configuration against a JSON schema
func (*Client) WaitForExists ¶
WaitForExists waits for a configuration to exist with timeout
type Config ¶
type Config struct {
RefreshInterval time.Duration
CacheEnabled bool
CacheExpiration time.Duration
CacheCleanup time.Duration
CacheSize int
TLSConfig *tls.Config
DefaultProvider string
FIPSMode bool
}
Config represents the configuration of the ConfiFlow client
type EncryptionProvider ¶
type EncryptionProvider = crypto.EncryptionProvider
EncryptionProvider represents an interface for encrypting and decrypting data
type MergeOptions ¶
type MergeOptions struct {
Strategy string // "deep" or "shallow"
ArrayMerge string // "replace" or "append"
IgnoreMissing bool // Skip configs that are not found
}
MergeOptions configures the merging behavior
type Option ¶
type Option func(*Config)
Option defines a configuration option for ConfiFlow
func WithCacheCleanup ¶
WithCacheCleanup sets the cache cleanup interval
func WithCacheEnabled ¶
WithCacheEnabled enables or disables caching
func WithCacheExpiration ¶
WithCacheExpiration sets the cache item expiration duration
func WithCacheSize ¶
WithCacheSize sets the maximum number of items in the cache
func WithDefaultProvider ¶
WithDefaultProvider sets the default provider to use
func WithFIPSMode ¶
WithFIPSMode enables FIPS 140-2 compliant mode
func WithRefreshInterval ¶
WithRefreshInterval sets the interval for polling configuration sources
func WithTLSConfig ¶
WithTLSConfig sets custom TLS configuration
type TemplateOptions ¶
type TemplateOptions struct {
Delimiters []string // Template delimiters (default: "{{", "}}")
CustomFuncs template.FuncMap // Custom template functions
IncludeEnv bool // Include environment variables
CustomValues map[string]interface{} // Custom values to use in templates
}
TemplateOptions configures template rendering behavior