summaryrefslogtreecommitdiffhomepage
path: root/webserver.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-26 19:52:44 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-26 19:52:44 +0200
commita595932283a3f3bf002eff5bf044762b78cab5f0 (patch)
tree790ba05f95b3fd3d6790f8132f9f6f95f908f18a /webserver.cpp
parentc73f913844f6aed9e740780f8a6732477fa3d680 (diff)
crypt(3) http auth pws
Diffstat (limited to 'webserver.cpp')
-rw-r--r--webserver.cpp30
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);