azappconfig

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package azappconfig loads configuration from Azure App Configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	// contains filtered or unexported fields
}

AppConfig is a Provider that loads configuration from Azure App Configuration.

To create a new AppConfig, call New.

func New

func New(endpoint string, opts ...Option) AppConfig

New creates an AppConfig with the given endpoint and Option(s).

func (AppConfig) Load

func (a AppConfig) Load() (map[string]any, error)

func (AppConfig) String

func (a AppConfig) String() string

func (AppConfig) Watch

func (a AppConfig) Watch(ctx context.Context, onChange func(map[string]any)) error

type Option

type Option func(options *options)

Option configures the AppConfig with specific options.

func WithCredential

func WithCredential(credential azcore.TokenCredential) Option

WithCredential provides the azcore.TokenCredential for Azure authentication.

By default, it uses azidentity.DefaultAzureCredential.

func WithKeyFilter

func WithKeyFilter(filter string) Option

WithKeyFilter provides key filter that will be used to select a set of configuration setting entities.

func WithKeySplitter

func WithKeySplitter(splitter func(string) []string) Option

WithKeySplitter provides the function used to split setting key into nested path. If it returns an nil/[]string{}/[]string{""}, the variable will be ignored.

For example, with the default splitter, a key like "parent/child/key" would be split into "parent", "child", and "key".

func WithLabelFilter

func WithLabelFilter(filter string) Option

WithLabelFilter provides label filter that will be used to select a set of configuration setting entities.

func WithLogHandler

func WithLogHandler(handler slog.Handler) Option

WithLogHandler provides the slog.Handler for logs from watch.

By default, it uses handler from slog.Default().

func WithPollInterval

func WithPollInterval(interval time.Duration) Option

WithPollInterval provides the interval for polling the configuration.

The default interval is 1 minute.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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