Skip to content

Commit

Permalink
merge to development (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 authored Jan 18, 2025
2 parents e6e2faf + 8a3df45 commit a87a2f8
Show file tree
Hide file tree
Showing 54 changed files with 39,377 additions and 35,207 deletions.
55 changes: 27 additions & 28 deletions OdbDesignLib/App/OdbServerAppBase.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include "OdbServerAppBase.h"
#include "OdbServerAppBase.h"
#include "Logger.h"
//#include "Logger.h"
#include "RequestAuthenticationBase.h"
#include "crow_win.h"
#include <boost/throw_exception.hpp>
#include <boost/system/system_error.hpp>
//#include <boost/throw_exception.hpp>
//#include <boost/system/system_error.hpp>
#include "OdbAppBase.h"
#include <ExitCode.h>
#include <memory>
#include <filesystem>
//#include <filesystem>

using namespace Utils;
using namespace std::filesystem;
Expand Down Expand Up @@ -55,29 +54,29 @@ namespace Odb::Lib::App
// enable HTTP compression
m_crowApp.use_compression(crow::compression::algorithm::GZIP);

try
{
if (args().useHttps())
{
path sslDirPath(args().sslDir());
if (!exists(sslDirPath) || !is_directory(sslDirPath))
{
logerror("SSL was specified but the directory does not exist, exiting...");
return ExitCode::FailedInitSslDirDoesNotExist;
}

// enable SSL/HTTPS
m_crowApp.ssl_file((sslDirPath / SSL_CERT_FILE).string(),
(sslDirPath / SSL_KEY_FILE).string());
}
}
catch (boost::wrapexcept<boost::system::system_error>& e)
{
// log the error
logexception(e);
logerror("SSL was specified but it failed to initialize, exiting...");
return ExitCode::FailedInitSsl;
}
//try
//{
// if (args().useHttps())
// {
// path sslDirPath(args().sslDir());
// if (!exists(sslDirPath) || !is_directory(sslDirPath))
// {
// logerror("SSL was specified but the directory does not exist, exiting...");
// return ExitCode::FailedInitSslDirDoesNotExist;
// }

// // enable SSL/HTTPS
// m_crowApp.ssl_file((sslDirPath / SSL_CERT_FILE).string(),
// (sslDirPath / SSL_KEY_FILE).string());
// }
//}
//catch (boost::wrapexcept<boost::system::system_error>& e)
//{
// // log the error
// logexception(e);
// logerror("SSL was specified but it failed to initialize, exiting...");
// return ExitCode::FailedInitSsl;
//}

// let subclasses add controller types
add_controllers();
Expand Down
6 changes: 3 additions & 3 deletions OdbDesignLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ target_link_libraries(OdbDesign PUBLIC protobuf::libprotobuf)
# add the generated Protobuf C++ files to the target
#target_sources(OdbDesign PRIVATE ${PROTO_SRCS} ${PROTO_HDRS})

# gRPC
find_package(gRPC CONFIG REQUIRED)
target_link_libraries(OdbDesign PUBLIC gRPC::grpc++)
# # gRPC
# find_package(gRPC CONFIG REQUIRED)
# target_link_libraries(OdbDesign PUBLIC gRPC::grpc++)

# workaround to remove error: "C++ command-line error: invalid macro definition: _CROW_ICD-NOTFOUND"
# (see https://github.com/CrowCpp/Crow/issues/661#issuecomment-1702544225)
Expand Down
4 changes: 2 additions & 2 deletions OdbDesignLib/IProtoBuffable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "odbdesign_export.h"
#include <ostream>
#include <istream>
#include <absl/strings/string_view.h>


namespace Odb::Lib
Expand Down Expand Up @@ -89,12 +90,11 @@ namespace Odb::Lib
template<typename TPbMessage>
inline void IProtoBuffable<TPbMessage>::from_json(const std::string& json)
{
google::protobuf::StringPiece sp_json(json);
// use default options
google::protobuf::util::JsonOptions jsonOptions;

auto pMessage = std::unique_ptr<TPbMessage>();
auto status = google::protobuf::util::JsonStringToMessage(sp_json, pMessage.get());
auto status = google::protobuf::util::JsonStringToMessage(absl::string_view(json), pMessage.get());
if (!status.ok()) return;
from_protobuf(*pMessage);
}
Expand Down
Loading

0 comments on commit a87a2f8

Please sign in to comment.