config
Use the Config tool to change a target's configuration database.
Also see Manage Config Tree
Functions supported include: inspect a tree, read/write values, and import/export enitre tree sections.
Usage
config [OPTIONS]
config get <tree path> [--format=json]
Read a value.
config set <tree path> <new value> [<type>]
Write a value.
config move <node path> <new name>
Move a node.
config copy <node path> <new name>
Copy a node.
config delete <tree path>
Delete a node.
config clear <tree path>
Clear a node. Or create a new empty node if it didn't previously exist.
config import <tree path> <file path> [--format=json]
Import config data.
config export <tree path> <file path> [--format=json]
Export config data.
config list
List all config trees.
config rmtree <tree name>
Delete a tree.
config help
Display help.
Options
<tree path>
Path to the tree and node to configure.
<tree name>
Is the name of a tree in the system, but without a path.
<file path>
Path to the file for import/export.
<new value>
String value to write to the config tree.
<type>
Optional, must be bool, int, float, or string. If tool, must be true or false. If unspecified, default type is string.
--format=json
For imports, then properly formatted JSON will be expected. For exports, then the data will be generated as well. It is also possible to specify JSON for the get sub-command.
Tree Paths
A tree path is specified similar to a *nix
path. With the beginning slash being optional.
For example: /a/path/to/somewhere or a/path/to/somewhere
The configTree supports multiple trees: a default tree is assigned per user. If the config tool is run as root, then alternative trees can be specified in the path by entering a tree name, then a colon and the value path.
Here's an example using the tree named 'foo' instead of the default tree:
foo:/a/path/to/somewhere
Tree location
The trees themselves are stored in the file system at:
/legato/systems/current/configTree
The configTree cycles through the extensions, .rock, .paper, and .scissors to differentiate between versions of the tree file. The base file name is the same as the tree.
A listing for /legato/systems/current/configTree where the system tree and the user trees are foo and bar looks like this:
$ ls /legato/systems/current/configTree/ -l total 32 -rw------- 1 user user 3456 May 12 11:02 bar.rock -rw------- 1 user user 3456 May 9 11:04 foo.scissors -rw------- 1 user user 21037 May 9 11:04 system.paper
The system, or root user, has its own tree; each application has a separate tree.
Config Code Samples
To dump a tree, run this to get the default tree for the current user:
config get /
Or to get a specific tree:
$ config get foo:/ / helloWorld/ greeted<bool> == true ignored<bool> == false
The config tool can also read and write individual values. You can read the value of greeted like this:
$ config get /helloWorld/greeted true
If you want to see everything under helloWorld:
$ config get /helloWorld helloWorld/ greeted<bool> == true ignored<bool> == false
If you want to change the value of ignored:
$ config set /helloWorld/ignored true bool
You can check it by running:
$ config get /helloWorld/ignored true
If the config tool is listing a tree, it will display the node name and a / if the current node has children (except for the root node, as the root node does not have a name.)
For leaf nodes, the config tool will display the value type in angle brackets, <>, as well as its name and actual value:
/ testValues/ aBoolValue<bool> == true aStringValue<string> == This is some text I saved. anIntValue<int> == 1024 afloatValue<float> == 10.24
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.