Skip to content

Instantly share code, notes, and snippets.

@b-coimbra
Created August 23, 2021 18:53
Show Gist options
  • Save b-coimbra/64fdf7943b0c5d9f6fe098b7dec21804 to your computer and use it in GitHub Desktop.
Save b-coimbra/64fdf7943b0c5d9f6fe098b7dec21804 to your computer and use it in GitHub Desktop.
converts function app config to standard json
const configuration = [
// YOUR EXPORTED AZURE CONFIGURATION
];
let exportedConfig = {};
configuration.forEach(setting => {
const subkeys = setting.name.split(':');
subkeys.reduce((acc, curr) => {
if (curr in acc) return acc[curr];
return acc[curr] = curr === subkeys[subkeys.length - 1] ? setting.value : {};
}, exportedConfig);
});
console.log(JSON.stringify(exportedConfig, null, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment