1 #include "Configuration.h"
3 namespace remote
{ namespace diku_mcs
{
5 void Configuration::read(int ac
, char** av
)
7 // command line options
8 po::options_description
cmdline_options("commandlineoptions");
9 cmdline_options
.add_options()
11 po::value
<std::string
>()->default_value("/etc/diku_mcs.cfg"),
12 "Path to the configuration file.")
14 po::value
<int>()->default_value(false),
17 // declare all configuration groups
18 po::options_description
config("Configuration");
22 po::value
<std::string
>(),
23 "Name of the infrastructure database.")
25 po::value
<std::string
>(),
26 "Host name of the infrastructure database server.")
28 po::value
<std::string
>(),
29 "User name for the infrastructure database.")
31 po::value
<std::string
>(),
32 "Password for the infrastructure database.")
33 ("sessionListenerPort",
34 po::value
<unsigned int>()->default_value(10000),
35 "Port number to use when listening for new sessions.")
37 po::value
<unsigned int>()->default_value(10001),
38 "Port number to use when listening for new hosts.")
40 po::value
<std::string
>()->default_value("/var/log/diku_mcs.log"),
41 "Path to the output log file when running as a daemon.")
43 po::value
<std::string
>()->default_value("/var/log/diku_mcs_error.log"),
44 "Path to the error log file when running as a daemon.")
47 store(po::parse_command_line(ac
, av
, cmdline_options
), vm
);
50 // get the configuration settings from a file
51 std::ifstream
ifs(Configuration::vm
["config-file"].as
<std::string
>().c_str());
52 store(parse_config_file(ifs
, config
), vm
);
56 po::variables_map
Configuration::vm
;