Inject server configuration instead of using a singleton

This commit is contained in:
2019-06-16 11:49:04 +02:00
parent e9509fb117
commit d00fc33197
7 changed files with 24 additions and 31 deletions

View File

@@ -65,11 +65,11 @@ void ConnectionOperator::HandleNewConnection(ClientSocket const & newClient)
newClient.WriteBytes(bytesToSend);
}
ConnectionOperator::ConnectionOperator(Logger & _logger)
ConnectionOperator::ConnectionOperator(Logger & _logger, ServerConfiguration const & serverConfiguration)
: logger(_logger)
{
// Base static file server
auto const & staticFileRoot = ServerConfiguration::GetInstance().GetWwwRoot();
auto const & staticFileRoot = serverConfiguration.GetWwwRoot();
if (staticFileRoot.size() > 0)
{
middlewares.emplace_back(std::make_unique<Middleware::StaticContent>(_logger, staticFileRoot));