manager

package
v0.380.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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

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

func (m *Manager[R]) Get(ctx context.Context, ref configuration.Ref, value any) error

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]) List

func (m *Manager[R]) List(ctx context.Context) ([]configuration.Entry, error)

func (*Manager[R]) MapForModule

func (m *Manager[R]) MapForModule(ctx context.Context, module string) (map[string][]byte, error)

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.

Jump to

Keyboard shortcuts

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