azappconfig

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package azappconfig loads configuration from Azure App Configuration.

It requires following roles to access Azure App Configuration:

  • App Configuration Data Reader

Change notification

By default, it periodically polls the configuration only. It also listens to change events by register it to notifier with Cloud Event schema.

Only following events trigger polling the configuration and other type of events are ignored:

  • Microsoft.AppConfiguration.KeyValueModified
  • Microsoft.AppConfiguration.KeyValueDeleted

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) OnEvent added in v1.1.0

func (a *AppConfig) OnEvent(event messaging.CloudEvent) error

func (*AppConfig) Status added in v0.8.0

func (a *AppConfig) Status(onStatus func(bool, 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 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