summaryrefslogtreecommitdiff
path: root/server/src/pracrod.cc
diff options
context:
space:
mode:
authordeva <deva>2009-08-07 11:27:18 +0000
committerdeva <deva>2009-08-07 11:27:18 +0000
commitd35bafeec39b6688a8dd07c51ea304e348b10fa2 (patch)
treeb615a7e28f5927841feb92d0b3c2da7f6c9feafa /server/src/pracrod.cc
parentfeed25360fe7b71d2ebdb523673d667e79123236 (diff)
Added new testdb, that can be activated through the cli (-d testdb) or through the config file (database_backend = testdb) .
Diffstat (limited to 'server/src/pracrod.cc')
-rw-r--r--server/src/pracrod.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc
index a929f63..75f58a6 100644
--- a/server/src/pracrod.cc
+++ b/server/src/pracrod.cc
@@ -88,6 +88,7 @@ static const char usage_str[] =
" -v, --version Print version information and exit.\n"
" -h, --help Print this message and exit.\n"
" -D, --debug ddd Enable debug messages on 'ddd'; see documentation for details\n"
+" -d --database db Use db as the database backend. Can be one of pgsql or testdb (default pgsql).\n"
;
ConfigurationParser *configparser = NULL;
@@ -145,6 +146,7 @@ int main(int argc, char *argv[])
bool foreground = false;
char *xml_basedir = NULL;
char *debugstr = NULL;
+ std::string database;
pracro_debug_init();
@@ -160,15 +162,20 @@ int main(int argc, char *argv[])
{"version", no_argument, 0, 'v'},
{"xml-basedir", required_argument, 0, 'x'},
{"debug", required_argument, 0, 'D'},
+ {"database", required_argument, 0, 'd'},
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "D:hvfc:u:g:x:", long_options, &option_index);
+ c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:", long_options, &option_index);
if (c == -1)
break;
switch(c) {
+ case 'd':
+ database = optarg;
+ break;
+
case 'c':
configfile = strdup(optarg);
break;
@@ -217,6 +224,10 @@ int main(int argc, char *argv[])
if(configfile) configparser = new ConfigurationParser(configfile);
else configparser = new ConfigurationParser(ETC"/pracrod.conf");
+ if(database != "") {
+ Conf::database_backend = database;
+ }
+
if(!user) {
user = strdup(Conf::server_user.c_str());
}