// Connecting to Azure App Configuration using connection string
const settings = await load(connectionString, {
// Setting up to refresh when the sentinel key is changed
refreshOptions: {
enabled: true,
watchedSettings: [{ key: "sentinel" }] // Watch for changes to the key "sentinel" and refreshes the configuration when it changes
// Connecting to Azure App Configuration using connection string
const settings = await load(connectionString, {
// Setting up to refresh when the sentinel key is changed
refreshOptions: {
enabled: true,
watchedSettings: [{ key: "sentinel" }] // Watch for changes to the key "sentinel" and refreshes the configuration when it changes
// Constructing configuration object
let config = settings.constructConfigurationObject();
// Setting up callback to ensure `config` object is updated once configuration is changed.
settings.onRefresh(() => {
config = settings.constructConfigurationObject();
// Polling for configuration changes every 5 seconds
while (true) {
await sleepInMs(5000); // Waiting before the next refresh
await settings.refresh(); // Refreshing the configuration setting
console.log(settings.get("message")); // Consume current value of message from a Map
// Polling for configuration changes every 5 seconds
while (true) {
await sleepInMs(5000); // Waiting before the next refresh
await settings.refresh(); // Refreshing the configuration setting
console.log(config.message); // Consume current value of message from an object
const sleepInMs = require("util").promisify(setTimeout);
const { load } = require("@azure/app-configuration-provider");
const connectionString = process.env.AZURE_APPCONFIG_CONNECTION_STRING;
async function run() {
// Connecting to Azure App Configuration using connection string
const settings = await load(connectionString, {
// Setting up to refresh when the sentinel key is changed
refreshOptions: {
enabled: true,
watchedSettings: [{ key: "sentinel" }] // Watch for changes to the key "sentinel" and refreshes the configuration when it changes
// Polling for configuration changes every 5 seconds
while (true) {
await sleepInMs(5000); // Waiting before the next refresh
await settings.refresh(); // Refreshing the configuration setting
console.log(settings.get("message")); // Consume current value of message from a Map
run().catch(console.error);
const sleepInMs = require("util").promisify(setTimeout);
const { load } = require("@azure/app-configuration-provider");
const connectionString = process.env.AZURE_APPCONFIG_CONNECTION_STRING;
async function run() {
// Connecting to Azure App Configuration using connection string
const settings = await load(connectionString, {
// Setting up to refresh when the sentinel key is changed
refreshOptions: {
enabled: true,
watchedSettings: [{ key: "sentinel" }] // Watch for changes to the key "sentinel" and refreshes the configuration when it changes
// Constructing configuration object
let config = settings.constructConfigurationObject();
// Setting up callback to ensure `config` object is updated once configuration is changed.
settings.onRefresh(() => {
config = settings.constructConfigurationObject();
// Polling for configuration changes every 5 seconds
while (true) {
await sleepInMs(5000); // Waiting before the next refresh
await settings.refresh(); // Refreshing the configuration setting
console.log(config.message); // Consume current value of message from an object
run().catch(console.error);