1313#include < Common/Fifo.h>
1414#include < Common/Thread.h>
1515
16+ #define WITH_CONFIG
17+ #ifdef WITH_CONFIG
18+ #include < Configuration/ConfigurationFactory.h>
19+ #endif
20+
21+
1622#include < atomic>
1723#include < chrono>
1824#include < memory>
@@ -75,11 +81,15 @@ int main(int argc, char* argv[])
7581{
7682 ConfigFile cfg;
7783 const char * cfgFileURI=" " ;
84+ const char * cfgFileEntryPoint=" " ; // where in the config tree to look for
7885 if (argc<2 ) {
7986 printf (" Please provide path to configuration file\n " );
8087 return -1 ;
8188 }
8289 cfgFileURI=argv[1 ];
90+ if (argc>2 ) {
91+ cfgFileEntryPoint=argv[2 ];
92+ }
8393
8494 // configure signal handlers for clean exit
8595 struct sigaction signalSettings;
@@ -105,9 +115,28 @@ int main(int argc, char* argv[])
105115 theLog.log (" NUMA : no" );
106116 #endif
107117 // load configuration file
108- theLog.log (" Reading configuration from %s" ,cfgFileURI);
118+ theLog.log (" Reading configuration from %s %s " ,cfgFileURI,cfgFileEntryPoint );
109119 try {
110- cfg.load (cfgFileURI);
120+ // check URI prefix
121+ if (!strncmp (cfgFileURI," file:" ,5 )) {
122+ // let's use the 'Common' config file library
123+ cfg.load (cfgFileURI);
124+ } else {
125+ // otherwise use the Configuration module, if available
126+ #ifdef WITH_CONFIG
127+ try {
128+ std::unique_ptr<o2::configuration::ConfigurationInterface> conf = o2::configuration::ConfigurationFactory::getConfiguration (cfgFileURI);
129+ boost::property_tree::ptree t=conf->getRecursive (cfgFileEntryPoint);
130+ cfg.load (t);
131+ // cfg.print();
132+ }
133+ catch (std::exception &e) {
134+ throw std::string (e.what ());
135+ }
136+ # else
137+ throw std::string (" This type of URI is not supported" );
138+ #endif
139+ }
111140 }
112141 catch (std::string err) {
113142 theLog.log (" Error : %s" ,err.c_str ());
0 commit comments