diff --git a/Makefile b/Makefile index 056f89f..d1cb6d1 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,6 @@ .POSIX: # Include path for Boost 1.81.0 and its libraries INC += -I/home/user/project/resources/boost_1_81_0 -L/home/user/project/resources/boost_1_81_0/stage/lib -# Include path for CPP-SMTPClient and its libraries -INC += -I/home/user/project/resources/CPP-SMTPClient-library/src -L/home/user/project/resources/CPP-SMTPClient-library # User include paths INC += -I/usr/include -L/usr/lib @@ -10,7 +8,7 @@ SRCFILES = src/main.cpp DEF += -DCROW_ENABLE_SSL -LIBS += -lpqxx -lfmt -l:libsmtpclient.a -lcrypto -lssl -pthread +LIBS += -lpqxx -lcurl -lcrypto -lssl -pthread db: ./setupdb.sh diff --git a/README.md b/README.md index 429fe7e..08040d1 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,24 @@ +## Running +./cavecomm {path to filled out cavecomm.conf} +if no path is given . will be considered the location + +It is possible to run without SSL support for that compilation has to occur without "-DCROW_ENABLE_SSL" ## Installation -Depends on: +Dependencies: +https://packages.debian.org/bullseye/openssl + +Postgress: https://packages.debian.org/bullseye/libpqxx-dev -https://packages.debian.org/bullseye/libfmt-dev -https://crowcpp.org + +SMTP: +https://packages.debian.org/bullseye/libcurlpp-dev + +CrowCPP: +https://crowcpp.org/ v1.0+5 +https://www.boost.org/ v1.81.0 **TODO: Write this** diff --git a/src/default-cavecomm.conf b/src/default-cavecomm.conf index ed7fc5a..7616834 100644 --- a/src/default-cavecomm.conf +++ b/src/default-cavecomm.conf @@ -5,9 +5,11 @@ # emailAddress= # emailPassword= # emailServerAddress= +# domain= + +# Optional if CROW_ENABLE_SSL not defined # sslCrtPath= # sslKeyPath= -# domain= # Optional: {default} # emailServerPort={587} diff --git a/src/main.cpp b/src/main.cpp index f491fe9..43e1b4d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -682,7 +682,6 @@ int main(int argc, char *argv[]) { string postRequestBody = postRequest.body; Utilities::decodeString(postRequestBody); newTemplate.parseRequestBodyIntoItem(postRequestBody); - newTemplate.outputItem(); pqxx::connection databaseConnection(configuration.databaseConnectionString); Database::prepareStatement(databaseConnection, ID_INSERT_FREELANCER_TEMPLATE); @@ -790,7 +789,6 @@ int main(int argc, char *argv[]) { Utilities::templateItem toEditTemplate; Database::prepareStatement(databaseConnection, ID_UPDATE_EDIT_FREELANCER_TEMPLATE); toEditTemplate.parseRequestBodyIntoItem(postRequestBody); - toEditTemplate.outputItem(); bool updateSuccess = Database::executePreparedStatement_UPDATE_EDIT_FREELANCER_TEMPLATE( databaseConnection, toEditTemplate.name, toEditTemplate.content, toEditTemplate.contactdata, toEditTemplate.contactinformation, @@ -1021,6 +1019,9 @@ int main(int argc, char *argv[]) { */ //set the port, set the app to run on multiple threads, and run the app +#ifdef CROW_ENABLE_SSL + cout << "SSL Enabled" << endl; app.ssl_file(configuration.sslCrtPath, configuration.sslKeyPath); +#endif app.port(18080).multithreaded().run(); } diff --git a/src/utilities.cpp b/src/utilities.cpp index 5162b7e..af6443b 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -2,14 +2,12 @@ #define UTILITIES_CPP #include -#include #include #include #include #include #include #include -#include #include #include @@ -106,8 +104,10 @@ namespace Utilities { || emailPassword.empty() || emailServerAddress.empty() || databaseConnectionString.empty() + #ifdef CROW_ENABLE_SSL || sslCrtPath.empty() || sslKeyPath.empty() + #endif || domain.empty() ) return 1; @@ -282,7 +282,7 @@ namespace Utilities { priceondeliver = "0"; } - void outputItem() { + void outputItem() const { std::cout << name << " " << content << " " << contactdata << " " << contactinformation << " " << currencypreference << " " << priceupfront << "-" << priceondeliver << " " << std::endl; }