|
| 1 | +# lib_config Documentation |
| 2 | + |
| 3 | +## Bundles |
| 4 | +`lib_config` supports Rock's bundle mechanisms. A Bundle is a predefined |
| 5 | +folder structure, where a certain places specific information s supposed |
| 6 | +to be found. |
| 7 | + |
| 8 | +Following the folder structure as expectd from `lib_config` is documented. |
| 9 | +Thereby all folders are give *relative to the root folder of a bundle*: |
| 10 | + |
| 11 | +## `config/orogen` |
| 12 | +YAML-like files containing configuration properties for components of a |
| 13 | +certain prototype. The name of a file within the folder has to correspond |
| 14 | +with the name of the prototype it contains the configuration properties for. |
| 15 | + |
| 16 | +**Example:** |
| 17 | +The file `config/orogen/joint_dispatcher::Task.yml` contains the properties for the Rock-Task `joint:dispatcher::Task`. |
| 18 | + |
| 19 | +## `data` |
| 20 | +Directory used for not further specified data. |
| 21 | + |
| 22 | +**TODO:** |
| 23 | +Clarify if and where in the code this folder is used and evaulate the reason. |
| 24 | + |
| 25 | +## `logs` |
| 26 | +The data logger per default outputs its log files to this folder. `lib_config` |
| 27 | +provides an API function `Bundle::createLogDirectory()` that creates a new |
| 28 | +log directory in the `logs` folder using the following pattern: |
| 29 | +`logs/%Y%m%d-%H%M`. |
| 30 | + |
| 31 | +If the function is called multiple times within the same minute, the name gets |
| 32 | +extended with a suffix: `logs/%Y%m%d-%H%M.i`, where `i` is incremented. |
| 33 | + |
| 34 | +## `logs/current` |
| 35 | +When the API function `Bundle::createLogDirectory()` is called (see `logs`), |
| 36 | +a symlink called `logs/current` is created that points to the folder that |
| 37 | +has just been created. Thus the symlink should always point to the most recently |
| 38 | +created log folder. |
| 39 | + |
| 40 | +## Configuration |
| 41 | +## Configuration files |
| 42 | +### `config/bundle.yml` |
| 43 | +This files YAML contains the configration properties of a bundle in form of a |
| 44 | +map called `bundle`. The following properties are supported: |
| 45 | + |
| 46 | + * `dependencies`: A list of bundle names containing data that is required for |
| 47 | + the present bundle to work. |
| 48 | + |
| 49 | +**Example:** |
| 50 | +```YAML |
| 51 | +# Bundle-specific configuration |
| 52 | +bundle: |
| 53 | + # List of bundles we depend on |
| 54 | + dependencies: |
| 55 | + - other_bundle |
| 56 | + - yet_another_bundle |
| 57 | + |
| 58 | +``` |
| 59 | + |
| 60 | +If the file is not present, it is assumed, that the bundle depends on no other |
| 61 | +bundles. |
| 62 | + |
| 63 | +We have a breadth-first discovery behaviour of dependencies. This means that |
| 64 | +first level dependecies are considered more relvant than second level |
| 65 | +dependencies. |
| 66 | + |
| 67 | +**Example:** This dependency tree |
| 68 | +``` |
| 69 | + bundle_1 |
| 70 | + |- bundle_2 |
| 71 | + |- bundle_4 |
| 72 | + |- bundle_3 |
| 73 | +``` |
| 74 | +is resolved to this priorization: |
| 75 | +``` |
| 76 | + 1. bundle_1 |
| 77 | + 2. bundle_2 |
| 78 | + 3. bundle_3 |
| 79 | + 4. bundle_4 |
| 80 | +``` |
| 81 | + |
| 82 | +## Environment Variables |
| 83 | +The following environment Variables are used |
| 84 | + |
| 85 | +### `ROCK_BUNDLE` |
| 86 | +Configures the currently selected bundle. `lib_config` allos to specify the |
| 87 | +bundle either by its name (i.e. folder-name of the Bundle visible within |
| 88 | +`ROCK_BUNDLE_PATH`) or absolute path. |
| 89 | + |
| 90 | +**Example:** |
| 91 | +Both examples |
| 92 | +```bash |
| 93 | +ROCK_BUNDLE_PATH=/home/malte/rock/bundles |
| 94 | +ROCK_BUNDLE=my_bundle |
| 95 | +``` |
| 96 | +and |
| 97 | +```bash |
| 98 | +ROCK_BUNDLE=/home/malte/rock/bundles/my_bundle |
| 99 | +``` |
| 100 | +refer to the same bundle at `/home/malte/rock/bundles/my_bundle` for |
| 101 | +`lib_config`. |
| 102 | + |
| 103 | +### `ROCK_BUNDLE_PATH` |
| 104 | +Defines a set of absolute folder-paths which are searched for bundles. Multiple |
| 105 | +paths are separated by thhe `:`-symbol. |
| 106 | + |
| 107 | +**Example:** |
| 108 | +```bash |
| 109 | +ROCK_BUNDLE_PATH=/home/malte/rock/bundles:/home/malte/rock/other_bundles |
| 110 | +``` |
0 commit comments