Documentation ¶
Index ¶
- func ConfigFromEnvironment() []string
- func ContextWithConfig(ctx context.Context, configManager *Manager[configuration.Configuration]) context.Context
- func ContextWithSecrets(ctx context.Context, secretsManager *Manager[configuration.Secrets]) context.Context
- func ProviderKeyForAccessor(accessor *url.URL) configuration.ProviderKey
- type Manager
- func ConfigFromContext(ctx context.Context) *Manager[configuration.Configuration]
- func New[R configuration.Role](ctx context.Context, router configuration.Router[R], ...) (*Manager[R], error)
- func NewConfigurationManager(ctx context.Context, router configuration.Router[configuration.Configuration]) (*Manager[configuration.Configuration], error)
- func NewDefaultConfigurationManagerFromConfig(ctx context.Context, config string) (*Manager[configuration.Configuration], error)
- func NewDefaultSecretsManagerFromConfig(ctx context.Context, config string, opVault string) (*Manager[configuration.Secrets], error)
- func NewSecretsManager(ctx context.Context, router configuration.Router[configuration.Secrets], ...) (*Manager[configuration.Secrets], error)
- func SecretsFromContext(ctx context.Context) *Manager[configuration.Secrets]
- func (m *Manager[R]) Get(ctx context.Context, ref configuration.Ref, value any) error
- func (m *Manager[R]) List(ctx context.Context) ([]configuration.Entry, error)
- func (m *Manager[R]) MapForModule(ctx context.Context, module string) (map[string][]byte, error)
- func (m *Manager[R]) Set(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref, ...) error
- func (m *Manager[R]) SetJSON(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref, ...) error
- func (m *Manager[R]) Unset(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigFromEnvironment ¶
func ConfigFromEnvironment() []string
func ContextWithConfig ¶
func ContextWithConfig(ctx context.Context, configManager *Manager[configuration.Configuration]) context.Context
ContextWithConfig adds a configuration manager to the given context.
func ContextWithSecrets ¶
func ContextWithSecrets(ctx context.Context, secretsManager *Manager[configuration.Secrets]) context.Context
ContextWithSecrets adds a secrets manager to the given context.
func ProviderKeyForAccessor ¶
func ProviderKeyForAccessor(accessor *url.URL) configuration.ProviderKey
Types ¶
type Manager ¶
type Manager[R configuration.Role] struct { // contains filtered or unexported fields }
Manager is a high-level configuration manager that abstracts the details of the Router and Provider interfaces.
func ConfigFromContext ¶
func ConfigFromContext(ctx context.Context) *Manager[configuration.Configuration]
ConfigFromContext retrieves the configuration.Manager previously added to the context with ContextWithConfig.
func New ¶
func New[R configuration.Role](ctx context.Context, router configuration.Router[R], providers []configuration.Provider[R]) (*Manager[R], error)
New configuration manager.
func NewConfigurationManager ¶
func NewConfigurationManager(ctx context.Context, router configuration.Router[configuration.Configuration]) (*Manager[configuration.Configuration], error)
NewConfigurationManager creates a new configuration manager with the default configuration providers.
func NewDefaultConfigurationManagerFromConfig ¶
func NewDefaultConfigurationManagerFromConfig(ctx context.Context, config string) (*Manager[configuration.Configuration], error)
NewDefaultConfigurationManagerFromConfig creates a new configuration manager from the project config found in the config paths.
func NewDefaultSecretsManagerFromConfig ¶
func NewDefaultSecretsManagerFromConfig(ctx context.Context, config string, opVault string) (*Manager[configuration.Secrets], error)
NewDefaultSecretsManagerFromConfig creates a new secrets manager from the project config found in the config paths.
func NewSecretsManager ¶
func NewSecretsManager(ctx context.Context, router configuration.Router[configuration.Secrets], opVault string, config string) (*Manager[configuration.Secrets], error)
NewSecretsManager creates a new secrets manager with the default secret providers.
func SecretsFromContext ¶
func SecretsFromContext(ctx context.Context) *Manager[configuration.Secrets]
SecretsFromContext retrieves the secrets configuration.Manager previously added to the context with ContextWithConfig.
func (*Manager[R]) Get ¶
Get a configuration value from the active providers.
"value" must be a pointer to a Go type that can be unmarshalled from JSON.
func (*Manager[R]) MapForModule ¶
MapForModule combines all configuration values visible to the module. Local values take precedence.
func (*Manager[R]) Set ¶
func (m *Manager[R]) Set(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref, value any) error
Set a configuration value, encoding "value" as JSON before storing it.
func (*Manager[R]) SetJSON ¶
func (m *Manager[R]) SetJSON(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref, value json.RawMessage) error
SetJSON sets a configuration value using raw JSON data.
func (*Manager[R]) Unset ¶
func (m *Manager[R]) Unset(ctx context.Context, pkey configuration.ProviderKey, ref configuration.Ref) error
Unset a configuration value in all providers.