This topic summarizes how to create read and write transactions to manage a target's configuration database (config tree).
There are also pre-built Config Tree APIs and a target config tool.
By default, every app gets read access to their own tree.
This code sample shows how an app can read a value from its own tree:
This code tries to read a value from the tree named, myApp. If the value /test/isBoolSet was previously written to the tree, that value will be returned. Otherwise, the default value false is returned.
Before you can write to a tree, you need to run as a user with the correct permissions. Permission settings are handled slightly differently, instead of writing under apps in the system tree, you write permission settings under the user's branch.
Processes running under the root user or those with the same user ID as the config tree process aren't restricted by permissions.
To create permissions, as the root user on the target console run config set
using the write
option:
The permissions are added to the system tree under /apps/myApp/configLimits/acl/myApp
.
Once the permissions are set, you can add a write function like this:
You may need to have one app read and another app read and write from a common tree.
To set permissions for two apps, as the root user on the target console run config set
using the common
option:
Granting write permission on a tree also gives read permission.
Once the permissions are set, you need to create a read to the tree name that includes the iterator path common:
like this:
A write also needs the tree name to include the iterator path common:
like this:
You can create read access to any tree, but typically you won't want it to run as a root process.
This code sample shows a supervisorApp with read access to any tree:
If you don't specify a tree name, the read will be created on the user's default tree: the tree with the same name as the app.
You may need to create a write for a process to any tree for a process that isn't part of app. This code sample uses the user name instead of the app name:
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.