azureappconfiguration package - github.com/Azure/AppConfiguration-GoProvider/azureappconfiguration - Go Packages (original) (raw)

Package azureappconfiguration provides a client for Azure App Configuration, enabling Go applications to manage application settings with Microsoft's Azure App Configuration service.

The azureappconfiguration package allows loading configuration data from Azure App Configuration in a structured way, with support for automatic Key Vault reference resolution, hierarchical configuration construction, and strongly typed configuration binding.

For more information about Azure App Configuration, see:https://learn.microsoft.com/en-us/azure/azure-app-configuration/

This section is empty.

This section is empty.

This section is empty.

AuthenticationOptions contains parameters for authenticating with the Azure App Configuration service. Either a connection string or an endpoint with credential must be provided.

type AzureAppConfiguration struct {

}

An AzureAppConfiguration is a configuration provider that stores and manages settings sourced from Azure App Configuration.

Load initializes a new AzureAppConfiguration instance and loads the configuration data from Azure App Configuration service.

Parameters:

Returns:

GetBytes returns the configuration as a JSON byte array with hierarchical structure. This method is particularly useful for integrating with "encoding/json" package or third-party configuration packages like Viper or Koanf.

Parameters:

Returns:

func (azappcfg *AzureAppConfiguration) OnRefreshSuccess(callback func())

OnRefreshSuccess registers a callback function that will be executed whenever the configuration is successfully refreshed and actual changes were detected.

Multiple callback functions can be registered, and they will be executed in the order they were added. Callbacks are only executed when configuration values actually change. They run synchronously in the thread that initiated the refresh.

Parameters:

Refresh manually triggers a refresh of the configuration from Azure App Configuration. It checks if any watched settings have changed, and if so, reloads all configuration data.

The refresh only occurs if:

If the configuration has changed, any callback functions registered with OnRefreshSuccess will be executed.

Parameters:

Returns:

Unmarshal parses the configuration and stores the result in the value pointed to v. It builds a hierarchical configuration structure based on key separators. It supports converting values to appropriate target types.

Fields in the target struct are matched with configuration keys using the field name by default. For custom field mapping, use json struct tags.

Parameters:

Returns:

type ConstructionOptions struct {

Separator [string](/builtin#string)

}

ConstructionOptions contains parameters for parsing keys with hierarchical structure.

type FeatureFlagOptions struct {

Enabled [bool](/builtin#bool)


Selectors [][Selector](#Selector)


RefreshOptions [RefreshOptions](#RefreshOptions)

}

FeatureFlagOptions contains optional parameters for Azure App Configuration feature flags that will be parsed and transformed into feature management configuration.

type KeyValueRefreshOptions struct {

WatchedSettings [][WatchedSetting](#WatchedSetting)


Interval [time](/time).[Duration](/time#Duration)


Enabled [bool](/builtin#bool)

}

KeyValueRefreshOptions contains optional parameters to configure the behavior of key-value settings refresh

KeyVaultOptions contains parameters to configure the build-in Key Vault reference resolution. These options determine how the provider will authenticate with and retrieve

type Options struct {

TrimKeyPrefixes [][string](/builtin#string)


Selectors [][Selector](#Selector)


RefreshOptions [KeyValueRefreshOptions](#KeyValueRefreshOptions)


KeyVaultOptions [KeyVaultOptions](#KeyVaultOptions)


FeatureFlagOptions [FeatureFlagOptions](#FeatureFlagOptions)


ClientOptions *azappconfig.ClientOptions


ReplicaDiscoveryEnabled *[bool](/builtin#bool)


LoadBalancingEnabled [bool](/builtin#bool)


StartupOptions [StartupOptions](#StartupOptions)

}

Options contains optional parameters to configure the behavior of an Azure App Configuration provider. It provides control over which key-values to fetch, how to trim key prefixes, and how to handle Key Vault references.

RefreshOptions contains optional parameters to configure the behavior of refresh

SecretResolver is an interface to resolve secrets from Key Vault references. Implement this interface to provide custom secret resolution logic.

Selector specifies what key-values to load from Azure App Configuration.

StartupOptions is used when initially loading data into the configuration provider.

WatchedSetting specifies the key and label of a key-value setting to watch for changes