For an Azure function, running on Linux, using Node.js runtime v14,
I want to read app configuration using @azure/app-configuration
,
when some config values are cleartext, but others are connection strings to keyvault.
My colleague, writing in C#, is using the ConfigureKeyVault
method on AzureAppConfigurationOptions
to configure the Azure App Configuration SDK to automatically parse, fetch, and decode secrets from their connections strings.
I'd like to do the same in nodejs, but did not find a similar method in the API docs
Will I have to do something like this?
async function getConfig(key: string): Promise<string> {
const maybeConnectionString = await appConfigurationClient.getConfigurationSetting({ key });
if (maybeConnectionString.startsWith('@Microsoft.KeyVault'))
return await keyVaultClient.getSecret(maybeConnectionString);
else
return maybeConnectionString;
}