diff --git a/config.h.in b/config.h.in index fbe643c..c66fc8d 100755 --- a/config.h.in +++ b/config.h.in @@ -9,6 +9,7 @@ #define DEFAULT_LOG_LEVEL LogLevel::info #endif +#define DEFAULT_TOKEN_TIMEOUT (60*5) #define DEFAULT_PORT 5555 #define DEFAULT_WEB_PREFIX "https://lock.binary.kitchen/" #define DEFAULT_LDAP_SERVER "ldaps://ldap.binary.kitchen" diff --git a/main.cpp b/main.cpp index 58640fa..b975b8b 100755 --- a/main.cpp +++ b/main.cpp @@ -97,15 +97,17 @@ int main(int argc, char** argv) string lockPagePrefix; string allowedIpPrefix; + l(LogLevel::notice, "Starting doorlockd"); + try { unsigned int timeout; po::options_description desc("usage: doorlockd"); desc.add_options() ("help,h", "print help") - ("tokentimeout,t", po::value(&timeout)->required(), "tokentimeout in seconds") + ("tokentimeout,t", po::value(&timeout)->default_value(DEFAULT_TOKEN_TIMEOUT), "Token timeout in seconds") ("port,p", po::value(&port)->default_value(DEFAULT_PORT), "Port") ("ldap,l", po::value(&ldapServer)->default_value(DEFAULT_LDAP_SERVER), "Ldap Server") - ("bidndn,b", po::value(&bindDN)->default_value(DEFAULT_BINDDN), "Bind DN %s means username") + ("bidndn,b", po::value(&bindDN)->default_value(DEFAULT_BINDDN), "Bind DN, %s means username") ("web,w", po::value(&lockPagePrefix)->default_value(DEFAULT_WEB_PREFIX), "Prefix of the webpage") ("ip,i", po::value(&allowedIpPrefix)->default_value(DEFAULT_ALLOWED_IP_PREFIX), "Default allowed IP Prefix"); @@ -135,8 +137,6 @@ int main(int argc, char** argv) lockPagePrefix, allowedIpPrefix)); - l(LogLevel::notice, "Starting doorlockd"); - try { boost::asio::io_service io_service; server s(io_service, port);