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:
# 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

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
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**

View File

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

View File

@ -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();
}

View File

@ -2,14 +2,12 @@
#define UTILITIES_CPP
#include <string>
#include <map>
#include <iostream>
#include <random>
#include <utility>
#include <vector>
#include <iomanip>
#include <stdexcept>
#include <chrono>
#include <thread>
#include <cmath>
@ -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;
}