Use App Config and Global Config from inside your app
This article refers to Platform v3.1.0. The current Platform version is v3.2.0.
Overview
A Barbara edge node exposes two JSON configuration channels to every workload:
- App Config — JSON edited in the Config segment of the workload card; scoped to one workload.
- Global Config — JSON edited in the Global Config card; shared by every workload on the node.
Both are surfaced inside the container as flat JSON files the app reads at runtime. Changes are picked up live, so you can push a new value from Panel and the app picks it up the next time it re-reads the file.
This article extends the MQTT app from the previous steps to publish messages that are driven by App Config and Global Config.
Watch this step on YouTube: Using App & Global Config in an Application.
Where the config lives inside the container
| Config | Path inside the container | Panel surface |
|---|---|---|
| Global Config | /appconfig/global.json | Global Config card |
| App Config | /appconfig/appconfig.json | Config segment of the workload card |
No special compose syntax is required — Barbara mounts both files into every container automatically. Your app just reads JSON from those paths.
Practice — publish messages driven by config
We will publish two MQTT messages every 5 seconds — one driven by Global Config, one by App Config.
1. Set Global Config
In the Global Config card on the Node Details page, set:
{
"message": "helloGlobal",
"topic": "test/globalTopic"
}
2. Set App Config
In the Config segment of the workload card for mqtt_client, set:
{
"message": "helloLocal",
"topic": "test/localTopic"
}
3. Read both configs from code
Add two helpers to test.py and call them in a loop:
import json
import time
def publish_global_config():
try:
with open('/appconfig/global.json') as f:
data = json.load(f)
client.publish(data["topic"], data["message"])
print(f"Published from Global Config: {data['message']} → {data['topic']}")
except Exception as exc:
print(f"Global config not available: {exc}")
def publish_app_config():
try:
with open('/appconfig/appconfig.json') as f:
data = json.load(f)
client.publish(data["topic"], data["message"])
print(f"Published from App Config: {data['message']} → {data['topic']}")
except Exception as exc:
print(f"App config not available: {exc}")
while True:
publish_global_config()
publish_app_config()
time.sleep(5)
4. Push a new version
Zip the source, upload it to the App Library as a new version of mqtt_client, and update the workload from its card.
5. Watch the changes live
Open MQTT Explorer (or any MQTT client) and connect to the Marketplace MQTT Broker. You should see messages on test/globalTopic and test/localTopic.
Now edit the App Config or the Global Config in Panel — the topic and the payload change on the next loop iteration without restarting the workload.
Summary
App Config and Global Config are the right home for non-sensitive, frequently-changing parameters. They reach your app as plain JSON files at known paths and reload live. For sensitive material, use Secrets instead — and for the full reference of all five configuration mechanisms, see Application configuration types.