From d35bafeec39b6688a8dd07c51ea304e348b10fa2 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 7 Aug 2009 11:27:18 +0000 Subject: Added new testdb, that can be activated through the cli (-d testdb) or through the config file (database_backend = testdb) . --- server/src/pracrod.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'server/src/pracrod.cc') 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()); } -- cgit v1.2.3