README Overhaul

Config SSL made optional
Minor Refactoring
This commit is contained in:
Tina_Azure 2023-05-29 15:09:42 +02:00
parent d9eec48d7c
commit 8102ea41dc
5 changed files with 26 additions and 12 deletions

View File

@ -1,8 +1,6 @@
.POSIX: .POSIX:
# Include path for Boost 1.81.0 and its libraries # 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 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 # User include paths
INC += -I/usr/include -L/usr/lib INC += -I/usr/include -L/usr/lib
@ -10,7 +8,7 @@ SRCFILES = src/main.cpp
DEF += -DCROW_ENABLE_SSL DEF += -DCROW_ENABLE_SSL
LIBS += -lpqxx -lfmt -l:libsmtpclient.a -lcrypto -lssl -pthread LIBS += -lpqxx -lcurl -lcrypto -lssl -pthread
db: db:
./setupdb.sh ./setupdb.sh

View File

@ -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 ## Installation
Depends on: Dependencies:
https://packages.debian.org/bullseye/openssl
Postgress:
https://packages.debian.org/bullseye/libpqxx-dev 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** **TODO: Write this**

View File

@ -5,9 +5,11 @@
# emailAddress= # emailAddress=
# emailPassword= # emailPassword=
# emailServerAddress= # emailServerAddress=
# domain=
# Optional if CROW_ENABLE_SSL not defined
# sslCrtPath= # sslCrtPath=
# sslKeyPath= # sslKeyPath=
# domain=
# Optional: {default} # Optional: {default}
# emailServerPort={587} # emailServerPort={587}

View File

@ -682,7 +682,6 @@ int main(int argc, char *argv[]) {
string postRequestBody = postRequest.body; string postRequestBody = postRequest.body;
Utilities::decodeString(postRequestBody); Utilities::decodeString(postRequestBody);
newTemplate.parseRequestBodyIntoItem(postRequestBody); newTemplate.parseRequestBodyIntoItem(postRequestBody);
newTemplate.outputItem();
pqxx::connection databaseConnection(configuration.databaseConnectionString); pqxx::connection databaseConnection(configuration.databaseConnectionString);
Database::prepareStatement(databaseConnection, ID_INSERT_FREELANCER_TEMPLATE); Database::prepareStatement(databaseConnection, ID_INSERT_FREELANCER_TEMPLATE);
@ -790,7 +789,6 @@ int main(int argc, char *argv[]) {
Utilities::templateItem toEditTemplate; Utilities::templateItem toEditTemplate;
Database::prepareStatement(databaseConnection, ID_UPDATE_EDIT_FREELANCER_TEMPLATE); Database::prepareStatement(databaseConnection, ID_UPDATE_EDIT_FREELANCER_TEMPLATE);
toEditTemplate.parseRequestBodyIntoItem(postRequestBody); toEditTemplate.parseRequestBodyIntoItem(postRequestBody);
toEditTemplate.outputItem();
bool updateSuccess = Database::executePreparedStatement_UPDATE_EDIT_FREELANCER_TEMPLATE( bool updateSuccess = Database::executePreparedStatement_UPDATE_EDIT_FREELANCER_TEMPLATE(
databaseConnection, toEditTemplate.name, toEditTemplate.content, toEditTemplate.contactdata, toEditTemplate.contactinformation, 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 //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); app.ssl_file(configuration.sslCrtPath, configuration.sslKeyPath);
#endif
app.port(18080).multithreaded().run(); app.port(18080).multithreaded().run();
} }

View File

@ -2,14 +2,12 @@
#define UTILITIES_CPP #define UTILITIES_CPP
#include <string> #include <string>
#include <map>
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <iomanip> #include <iomanip>
#include <stdexcept> #include <stdexcept>
#include <chrono>
#include <thread> #include <thread>
#include <cmath> #include <cmath>
@ -106,8 +104,10 @@ namespace Utilities {
|| emailPassword.empty() || emailPassword.empty()
|| emailServerAddress.empty() || emailServerAddress.empty()
|| databaseConnectionString.empty() || databaseConnectionString.empty()
#ifdef CROW_ENABLE_SSL
|| sslCrtPath.empty() || sslCrtPath.empty()
|| sslKeyPath.empty() || sslKeyPath.empty()
#endif
|| domain.empty() || domain.empty()
) )
return 1; return 1;
@ -282,7 +282,7 @@ namespace Utilities {
priceondeliver = "0"; priceondeliver = "0";
} }
void outputItem() { void outputItem() const {
std::cout << name << " " << content << " " << contactdata << " " << contactinformation << " " << currencypreference std::cout << name << " " << content << " " << contactdata << " " << contactinformation << " " << currencypreference
<< " " << priceupfront << "-" << priceondeliver << " " << std::endl; << " " << priceupfront << "-" << priceondeliver << " " << std::endl;
} }