|
5 | 5 |
|
6 | 6 | #include "SimpleLog.h" |
7 | 7 | #include <string> |
| 8 | +#include <vector> |
8 | 9 |
|
9 | 10 | #include <Common/Configuration.h> |
10 | 11 |
|
@@ -35,13 +36,15 @@ class Daemon |
35 | 36 | // takes as input main(argc,argv) command line parameters, and custom configuration options. |
36 | 37 | // accepted command line parameters: |
37 | 38 | // -z configFileURI : load provided config file (e.g. file:../.../daemon.cfg. See Configuration.h for URI specs) |
38 | | - // -okey=value : set a given key/value pair parameter. |
| 39 | + // -o key=value : set a given key/value pair parameter. |
39 | 40 | // |
40 | 41 | // Configuration options may are overwritten by those provided in [daemon] section of the config file, if any. |
41 | 42 | // There is a 1-to-1 match between key names and members of the DaemonConfigParameters class. |
42 | 43 | // i.e. user name running the daemon can be set by passing a pointer to a custom DaemonConfigParameters object, |
43 | 44 | // but it is overwritten by value of [daemon] userName key in configuration file, if defined. |
44 | | - Daemon(int argc = 0, char* argv[] = nullptr, DaemonConfigParameters* = nullptr); |
| 45 | + // Optional argument "extraCommandLineOptions" gives a list of extra option keys (-o key=value) accepted on the command line. |
| 46 | + // They are parsed and made available in the "execOptions" variable after initialization. |
| 47 | + Daemon(int argc = 0, char* argv[] = nullptr, DaemonConfigParameters* = nullptr, std::vector<std::string> extraCommandLineOptions = {}); |
45 | 48 |
|
46 | 49 | // destructor |
47 | 50 | virtual ~Daemon(); |
@@ -69,6 +72,13 @@ class Daemon |
69 | 72 | SimpleLog log; // object for output logging. |
70 | 73 | ConfigFile config; // input configuration file, if any. Loaded if path provided on command line. |
71 | 74 |
|
| 75 | + struct ConfigOption { |
| 76 | + std::string key; |
| 77 | + std::string value; |
| 78 | + }; |
| 79 | + |
| 80 | + std::vector<ConfigOption> execOptions; // options extracted from command line arguments (-o key=value) |
| 81 | + |
72 | 82 | // check daemon status (e.g. after constructor, before starting main loop by calling run(), to know if init success) |
73 | 83 | bool isOk(); |
74 | 84 |
|
|
0 commit comments