Product Help

Configuration Package Methods and Functions

InitializeKeyVault

func InitializeKeyVault() (KeyVault, error)

InitializeKeyVault initializes the Azure Key Vault by setting up a secret client. Currently, it uses Azure CLI Identity for authentication, and the original Managed Identity code is commented out.

Returns:

  • KeyVault: The new KeyVault instance.

  • error: Any errors from the method.

GetSecret

func (kv KeyVault) GetSecret(ctx context.Context, secretName string) (string, error)

GetSecret retrieves the value of a secret from Azure Key Vault by its name. It initializes the secret client if not already initialized.

Parameters:

  • ctx: Context for the method.

  • secretName: Name of the secret.

Returns:

  • string: Secret value.

  • error: Any errors from the method.

InitializeAppConfig

func InitializeAppConfig() (AppConfig, error)

InitializeAppConfig initializes the Azure App Configuration client using Azure CLI credentials. Connection-string-based and DefaultAzureCredential-based implementations are commented out for future use.

Returns:

  • AppConfig: The new AppConfig instance.

  • error: Any errors from the method.

GetConfigSetting

func (ac AppConfig) GetConfigSetting(ctx context.Context, key string) (string, error)

GetConfigSetting retrieves the configuration setting from Azure App Configuration using the given key.

Parameters:

  • ctx: Context for the method.

  • key: Key to used for query.

Returns:

  • string: Config settings.

  • error: Any errors from the method.

Last modified: 28 January 2025