Configuration file readout
specification of the format in the spec
This commit is contained in:
24
src/main.cpp
24
src/main.cpp
@ -8,9 +8,16 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int main(int argc, char *argv[]) {
|
||||
Utilities::config configuration;
|
||||
configuration.readConfigFile();
|
||||
if (argc > 0)
|
||||
configuration.configPath = argv[1];
|
||||
|
||||
if (configuration.readConfigFile()) {
|
||||
std::cout << "ERROR: Unable to read configuration file: " << configuration.configPath << endl;
|
||||
std::cout << "Aborting Startup!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
crow::SimpleApp app;
|
||||
|
||||
@ -126,6 +133,17 @@ int main() {
|
||||
auto page = crow::mustache::load(templateHTML);
|
||||
|
||||
crow::mustache::context ctx(resultJsonTemplate);
|
||||
|
||||
bool commissionState = false;
|
||||
if (resultTemplate.size() > 0) {
|
||||
//use freelancerID based on SQL_STATEMENT_SELECT_TEMPLATE
|
||||
pqxx::result resultCommissionState = Database::executePreparedStatement_SELECT_FREELANCER_COMMISSION_STATE(databaseConnection, stoi(resultTemplate.at(0).at(2).c_str()));
|
||||
//the commissionstate
|
||||
if (resultCommissionState.size() == 0 || stoi(resultCommissionState.at(0).at(0).c_str()) == 1)
|
||||
commissionState = true;
|
||||
}
|
||||
ctx["ERROR_COMMISSIONS_CLOSED"] = commissionState;
|
||||
|
||||
return page.render(ctx);
|
||||
});
|
||||
|
||||
@ -202,7 +220,7 @@ int main() {
|
||||
pqxx::result resultCommissionState = Database::executePreparedStatement_SELECT_FREELANCER_COMMISSION_STATE(databaseConnection, newRequest.freelancerID);
|
||||
|
||||
//the commissionstate
|
||||
if (resultCommissionState.size() == 0 || stoi(resultTemplate.at(0).at(0).c_str()) == 1) {
|
||||
if (resultCommissionState.size() == 0 || stoi(resultCommissionState.at(0).at(0).c_str()) == 1) {
|
||||
ctx["ERROR_COMMISSIONS_CLOSED"] = true;
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user