diff options
Diffstat (limited to 'webserver.cpp')
-rw-r--r-- | webserver.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/webserver.cpp b/webserver.cpp index c49751e..98fedc3 100644 --- a/webserver.cpp +++ b/webserver.cpp @@ -1,3 +1,4 @@ +#include "auth.h" #include "config.h" #include "server.h" #include "plugin.h" @@ -21,25 +22,30 @@ void initlocale() { int main(int argc, char* argv[]) { - //initlocale(); // TODO: breaks plugins - - std::string config_filename; + try { + //initlocale(); // TODO: breaks plugins - if (!(argc == 1 || argc == 3)) { - usage(); - return 1; - } + std::string config_filename; - if (argc == 3) { - if (argv[1] != "-c"s) { + if (!(argc == 1 || argc == 3)) { usage(); return 1; } - config_filename = argv[2]; - } + if (argc == 3) { + + // normal run with configuration file specified + if (argv[1] == "-c"s) { + config_filename = argv[2]; + } else if (argv[1] == "-p"s) { // generate crypted password + std::cout << Auth::generate(argv[2]) << std::endl; + return 0; + } else { + usage(); + return 1; + } + } - try { Config config{config_filename}; PluginLoader plugin_loader(config); |