@@ -12,48 +12,83 @@ import (
1212)
1313
1414// Options contains optional parameters to configure the behavior of an Azure App Configuration provider.
15- // If selectors are not provided, all key-values with no label are loaded .
15+ // It provides control over which key-values to fetch, how to trim key prefixes, and how to handle Key Vault references .
1616type Options struct {
17- // Trims the provided prefixes from the keys of all key-values retrieved from Azure App Configuration.
17+ // TrimKeyPrefixes specifies a list of prefixes to trim from the keys of all key-values
18+ // retrieved from Azure App Configuration, making them more suitable for binding to structured types.
1819 TrimKeyPrefixes []string
20+
21+ // Selectors defines what key-values to load from Azure App Configuration
22+ // Each selector combines a key filter and label filter
23+ // If selectors are not provided, all key-values with no label are loaded by default.
1924 Selectors []Selector
25+
26+ // KeyVaultOptions configures how Key Vault references are resolved.
2027 KeyVaultOptions KeyVaultOptions
28+
29+ // ClientOptions provides options for configuring the underlying Azure App Configuration client.
2130 ClientOptions * azappconfig.ClientOptions
2231}
2332
24- // AuthenticationOptions contains optional parameters to construct an Azure App Configuration client
25- // ConnectionString or endpoint with credential must be be provided
33+ // AuthenticationOptions contains parameters for authenticating with the Azure App Configuration service.
34+ // Either a connection string or an endpoint with credential must be provided.
2635type AuthenticationOptions struct {
36+ // Credential is a token credential for Azure EntraID Authenticaiton.
37+ // Required when Endpoint is provided.
2738 Credential azcore.TokenCredential
39+
40+ // Endpoint is the URL of the Azure App Configuration service.
41+ // Required when using token-based authentication with Credential.
2842 Endpoint string
43+
44+ // ConnectionString is the connection string for the Azure App Configuration service.
2945 ConnectionString string
3046}
3147
32- // Selector specifies what key-values to include in the configuration provider .
48+ // Selector specifies what key-values to load from Azure App Configuration .
3349type Selector struct {
50+ // KeyFilter specifies which keys to retrieve from Azure App Configuration.
51+ // It can include wildcards, e.g. "app*" will match all keys starting with "app".
3452 KeyFilter string
53+
54+ // LabelFilter specifies which labels to retrieve from Azure App Configuration.
55+ // Empty string or omitted value will use the default no-label filter.
56+ // Note: Wildcards are not supported in label filters.
3557 LabelFilter string
3658}
3759
38- // SecretResolver is an interface to resolve secret from key vault reference
60+ // SecretResolver is an interface to resolve secrets from Key Vault references.
61+ // Implement this interface to provide custom secret resolution logic.
3962type SecretResolver interface {
40- // keyVaultReference: "https://{keyVaultName}.vault.azure.net/secrets/{secretName}/{secretVersion}"
63+ // ResolveSecret resolves a Key Vault reference URL to the actual secret value.
64+ //
65+ // Parameters:
66+ // - ctx: The context for the operation
67+ // - keyVaultReference: A URL in the format "https://{keyVaultName}.vault.azure.net/secrets/{secretName}/{secretVersion}"
68+ //
69+ // Returns:
70+ // - The resolved secret value as a string
71+ // - An error if the secret could not be resolved
4172 ResolveSecret (ctx context.Context , keyVaultReference url.URL ) (string , error )
4273}
4374
44- // KeyVaultOptions contains optional parameters to configure the behavior of key vault reference resolution
75+ // KeyVaultOptions contains parameters to configure the build-in Key Vault reference resolution.
76+ // These options determine how the provider will authenticate with and retrieve
4577type KeyVaultOptions struct {
46- // Credential specifies the token credential used to authenticate to key vaults
78+ // Credential specifies the token credential used to authenticate to Azure Key Vault services.
79+ // This is required for Key Vault reference resolution unless a custom SecretResolver is provided.
4780 Credential azcore.TokenCredential
4881
49- // SecretResolver specifies the callback used to resolve key vault references
82+ // SecretResolver specifies a custom implementation for resolving Key Vault references.
83+ // When provided, this takes precedence over using the default resolver with Credential.
5084 SecretResolver SecretResolver
5185}
5286
53- // ConstructionOptions contains optional parameters for Unmarshal and GetBytes methods
87+ // ConstructionOptions contains parameters for parsing keys with hierarchical structure.
5488type ConstructionOptions struct {
55- // Separator is used to unmarshal configuration when the keys themselves contain the separator
89+ // Separator specifies the character used to determine hierarchy in configuration keys
90+ // when mapping to nested struct fields during unmarshaling operations.
5691 // Supported values: '.', ',', ';', '-', '_', '__', '/', ':'.
57- // If not provided, the default separator "." will be used
92+ // If not provided, the default separator "." will be used.
5893 Separator string
5994}
0 commit comments