From 78cab4908b1784c67bee0064502854b1a984342f Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 7 Jul 2010 11:55:58 +0000 Subject: Make session-path set-able via cli. --- server/src/pracrod.cc | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'server') diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc index 1488909..73fe259 100644 --- a/server/src/pracrod.cc +++ b/server/src/pracrod.cc @@ -80,17 +80,18 @@ static const char copyright_str[] = static const char usage_str[] = "Usage: %s [options]\n" "Options:\n" -" -c, --config file Read configfile from 'file'\n" -" -f, --foreground Run in foreground mode (non-background mode)\n" -" -u, --user user Run as 'user' (overrides the configfile)\n" -" -g, --group group Run as 'group' (overrides the configfile)\n" -" -x, --xml-basedir d Use 'd' as basedir for finding template- and macro-files (default "XML").\n" -" -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" -" -s, --ssl keyfile Enable ssl encryption with the key stored in keyfile.\n" -" -L, --logfile file Write output to file, instead of stderr.\n" +" -c, --config file Read configfile from 'file'\n" +" -f, --foreground Run in foreground mode (non-background mode)\n" +" -u, --user user Run as 'user' (overrides the configfile)\n" +" -g, --group group Run as 'group' (overrides the configfile)\n" +" -x, --xml-basedir d Use 'd' as basedir for finding template- and macro-files (default "XML").\n" +" -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" +" -s, --ssl keyfile Enable ssl encryption with the key stored in keyfile.\n" +" -L, --logfile file Write output to file, instead of stderr.\n" +" -S, --session-path dir Use dir as the path for active session storage.\n" ; ConfigurationParser *configparser = NULL; @@ -185,6 +186,7 @@ int main(int argc, char *argv[]) char *debugstr = NULL; std::string database; std::string pidfile; + std::string sessionpath; int option_index = 0; while(1) { @@ -202,10 +204,11 @@ int main(int argc, char *argv[]) {"ssl", required_argument, 0, 's'}, {"pidfile", required_argument, 0, 'P'}, {"logfile", required_argument, 0, 'L'}, + {"session-path", required_argument, 0, 'S'}, {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:L:P:", + c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:L:P:S:", long_options, &option_index); if (c == -1) @@ -244,6 +247,10 @@ int main(int argc, char *argv[]) logfile = optarg; break; + case 'S': + sessionpath = optarg; + break; + case 'D': debugstr = strdup(optarg); break; @@ -292,6 +299,10 @@ int main(int argc, char *argv[]) if(configfile) configparser = new ConfigurationParser(configfile); else configparser = new ConfigurationParser(ETC"/pracrod.conf"); + if(sessionpath != "") { + Conf::session_path = sessionpath; + } + if(database != "") { Conf::database_backend = database; } -- cgit v1.2.3