WIP. Adding config file handling. UserInterface settings implemented
This commit is contained in:
@@ -1,17 +1,43 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "UserInterfaceService.hpp"
|
||||
#include "ui/LmsApplication.hpp"
|
||||
|
||||
UserInterfaceService::UserInterfaceService( int argc, char* argv[], boost::filesystem::path dbPath)
|
||||
: _server(argv[0], "")
|
||||
namespace Service {
|
||||
|
||||
UserInterfaceService::UserInterfaceService( boost::filesystem::path runAppPath, const Config& config)
|
||||
: _server(runAppPath.string())
|
||||
{
|
||||
// TODO configure server using another way (config file?)
|
||||
_server.setServerConfiguration (argc, argv, WTHTTP_CONFIGURATION);
|
||||
std::vector<std::string> args;
|
||||
|
||||
args.push_back(runAppPath.string());
|
||||
args.push_back("--docroot=" + config.docRootPath.string());
|
||||
args.push_back("--approot=" + config.appRootPath.string());
|
||||
{
|
||||
std::ostringstream oss; oss << config.httpsPort;
|
||||
args.push_back("--https-port=" + oss.str());
|
||||
}
|
||||
args.push_back("--https-address=" + config.httpsAddress.to_string());
|
||||
args.push_back("--ssl-certificate=" + config.sslCertificatePath.string());
|
||||
args.push_back("--ssl-private-key=" + config.sslPrivateKeyPath.string());
|
||||
args.push_back("--ssl-tmp-dh=" + config.sslTempDhPath.string());
|
||||
|
||||
// Construct argc/argv
|
||||
int argc = args.size();
|
||||
const char* argv[args.size()];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
argv[i] = args[i].c_str();
|
||||
|
||||
for(int i = 0; i < argc; ++i)
|
||||
{
|
||||
std::cout << "i = " << i << ", arg = '" << argv[i] << "'" << std::endl;
|
||||
}
|
||||
|
||||
_server.setServerConfiguration (argc, const_cast<char**>(argv));
|
||||
|
||||
// bind entry point
|
||||
_server.addEntryPoint(Wt::Application, boost::bind(UserInterface::LmsApplication::create, _1, dbPath));
|
||||
_server.addEntryPoint(Wt::Application, boost::bind(UserInterface::LmsApplication::create, _1, config.dbPath));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -35,4 +61,5 @@ UserInterfaceService::restart(void)
|
||||
|
||||
}
|
||||
|
||||
} // namespace Service
|
||||
|
||||
|
||||
Reference in New Issue
Block a user