first release 0.1.1
This commit is contained in:
17
src/main.cpp
17
src/main.cpp
@@ -3,6 +3,7 @@
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <print>
|
||||
#include <optional>
|
||||
#include "json_settings.h"
|
||||
#include "htmx_helper.h"
|
||||
@@ -68,5 +69,19 @@ int main() {
|
||||
return crow::response{row.htmx()};
|
||||
});
|
||||
|
||||
app.port(8080).multithreaded().run();
|
||||
const uint16_t defaultPort = 3010;
|
||||
uint16_t httpPort = defaultPort;
|
||||
|
||||
{
|
||||
auto opt_settings = AppSettings::loadAppSettings();
|
||||
if (opt_settings.has_value()){
|
||||
auto& settings = opt_settings.value();
|
||||
httpPort = settings.httpPort.value_or(defaultPort);
|
||||
} else {
|
||||
CROW_LOG_ERROR << "failed to load settings : " << opt_settings.error();
|
||||
}
|
||||
}
|
||||
|
||||
app.loglevel(crow::LogLevel::INFO);
|
||||
app.port(httpPort).multithreaded().run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user