Querying a Bedrock configuration ================================ Once one or multiple Bedrock daemons have been deployed, it is possible to query their complete configuration, either via command line, or using a C++ program. bedrock-query ------------- :code:`bedrock-query` is a program installed with Bedrock that can query the configuration of one or multiple daemons and print it on its standard output. It is called as follows. .. code-block:: console bedrock-query -a
** is the protocol used by the Bedrock daemon (and consequently by the query program), e.g. :code:`na+sm`. *
* is the Mercury address of the Bedrock daemon process. The configuration is printed to the standard output in the form of a JSON object associating the address with its configuration. Multiple addresses can be passed, e.g.: .. code-block:: console bedrock-query -a -a -a In this case, the resulting JSON object will have three entries, one for each address. If all the daemons are gathered in an SSG group represented by a group file of a given **, the following command will query all the members of the group. .. code-block:: console bedrock-query -s The :code:`-i/--provider-id` flag may be used to specify a provider id other than 0. For instance: .. code-block:: console bedrock-query -a
-i 42 Using Jx9 queries ----------------- Sometimes it may be useful to have Bedrock daemons execute some code to return only some specific information from their configuration. This can be done using the `jx9 language `_. From within a Jx9 script, the :code:`$__config__` variable contains the configuration of the Bedrock daemon. The client will be sent back the value returned by the script via its :code:`return` statement. For example, the following Jx9 script makes the daemon return only the names of the providers it manages. .. literalinclude:: ../../../code/bedrock/03_query/query.jx9 :language: php Calling :code:`bedrock-query` with the :code:`-j