Documentation ¶
Index ¶
- func AddressOfString(s string) *string
- func Escape(s string) string
- type ConfigReader
- func (cr *ConfigReader[T]) Load(ctx context.Context) (*T, error)
- func (cr *ConfigReader[T]) WithDisableEnvVarOverride(vars ...string) *ConfigReader[T]
- func (cr *ConfigReader[T]) WithExtendedValidator(validator ExtendedValidator[T]) *ConfigReader[T]
- func (cr *ConfigReader[T]) WithLoader(l ...model.Loader) *ConfigReader[T]
- func (cr *ConfigReader[T]) WithMonitor(m *Monitor[T]) *ConfigReader[T]
- type ExtendedValidator
- type Monitor
- type SettingsChangedCallback
- type ValidationError
- type ValidationErrorFailure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressOfString ¶
AddressOfString returns the address of the provided string
Types ¶
type ConfigReader ¶
type ConfigReader[T any] struct { // contains filtered or unexported fields }
ConfigReader contains configurable loader options.
func (*ConfigReader[T]) Load ¶
func (cr *ConfigReader[T]) Load(ctx context.Context) (*T, error)
Load settings from the specified source
func (*ConfigReader[T]) WithDisableEnvVarOverride ¶ added in v0.2.0
func (cr *ConfigReader[T]) WithDisableEnvVarOverride(vars ...string) *ConfigReader[T]
WithDisableEnvVarOverride stops the loader from replacing environment variables that can be found inside
func (*ConfigReader[T]) WithExtendedValidator ¶
func (cr *ConfigReader[T]) WithExtendedValidator(validator ExtendedValidator[T]) *ConfigReader[T]
WithExtendedValidator sets an optional settings validator callback
func (*ConfigReader[T]) WithLoader ¶
func (cr *ConfigReader[T]) WithLoader(l ...model.Loader) *ConfigReader[T]
WithLoader sets the content loader
func (*ConfigReader[T]) WithMonitor ¶
func (cr *ConfigReader[T]) WithMonitor(m *Monitor[T]) *ConfigReader[T]
WithMonitor sets a monitor that will inform about configuration settings changes
NOTE: First send a value to stop monitoring and then wait until a value is received on the same channel
type ExtendedValidator ¶
ExtendedValidator is a function to call in order to do configuration validation not covered by this library.
type Monitor ¶
type Monitor[T any] struct { // contains filtered or unexported fields }
Monitor implements a module that periodically checks if the configuration setting changed.
func NewMonitor ¶
func NewMonitor[T any](pollInterval time.Duration, callback SettingsChangedCallback[T]) *Monitor[T]
NewMonitor creates a new configuration settings change monitor
type SettingsChangedCallback ¶
SettingsChangedCallback is a function to call when the re-loader detects a change in the configuration settings.
type ValidationError ¶
type ValidationError struct {
Failures []ValidationErrorFailure
}
ValidationError represents a set of ValidationErrorFailure.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶
func (*ValidationError) Unwrap() error
type ValidationErrorFailure ¶
ValidationErrorFailure represents a specific JSON schema validation error.
func (*ValidationErrorFailure) Error ¶ added in v0.2.0
func (e *ValidationErrorFailure) Error() string